Message ID | 20240229222127.1878176-1-alexandre.belloni@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-87634-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp714984dyb; Thu, 29 Feb 2024 14:22:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXnG8hJUYycHQlg6VOtcVwUeeFRnmdg1yhePBL0wXE0h1F83P4WLrVG1heIRscHCavOCncZsU7Fb2i1GVqLFmgvvEjhKw== X-Google-Smtp-Source: AGHT+IHGtNywDl6ekfrdieyUlYrIe7gA60WVfaoSDSJDEc0HKYDV8A57uBTFRquM92E6JHFU88yF X-Received: by 2002:a05:6a00:4fce:b0:6e5:64cd:8f52 with SMTP id le14-20020a056a004fce00b006e564cd8f52mr79553pfb.0.1709245345906; Thu, 29 Feb 2024 14:22:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709245345; cv=pass; d=google.com; s=arc-20160816; b=jFBzSFPB4jjaLa9K1hC9bZM71cusah0HTKn8TaqGzhZ++jQsBe6jXVk5DFdV018y1P bMK/GgrByYLAqHbfr+9vQS2DQRPCG3gd7V0A3P3hQhcSboojkOjumO8CtHiAOKrYyF71 MnXroNXzUHHHVgtZs4OsZCNSJevfVO+fICenbvZ0/wpPfckku1txcDeJdXWHgqi5U/LR zrWQN2d3uwKH6WURMnEtPz6khjA9KBQAtlgjG/WHJVZCln2eC4KPSQDw0DIyHnfqQJ9u 35/cv4RvwdIsReNHfhvclZTVdulnu1LomaUDqB09Yw45WKSvd0ZEkfjd9ePIT1opKhpi OQ0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=vXQti813qjlmOLifixiuae4rGnXkl/dZRgzemhLIIuI=; fh=M942pblipM4ddGrORTNsxjHFz+gU8v5aZ3ewWyRL1g0=; b=m7GFCkCzLxI6GAEnoivO2q2JJKRNPrkCr7lzoidrQeRYPGOx+fF2lCcfztSbJqr4Ir 6tZK/9vQnTFWqJ8EAewOR57ty72wC4E73EM4lVHhYRmtY79Qt3Jv0SKPtiD3zWw4xuAA cO2JmE9JRa08Ayr+eyx/oxOmA6nsfmKa4Z3uQBS4tY6VxkTOdw2aICIXwHzwlS8Qux7f RaVpEvlFRiPPvT+e5u3/hHitdmWTj1NjYxWmALEsDz9vjd1L0oGykDv/qG1XwNxDor+C 7K7DQKBX1vjeHJRw1ko/eLDGAC7wvs/ub2xHIt6wcQcQIzHJBnQQnTqZC5EfGPKTk5kg CJdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=BboKlfR0; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-87634-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87634-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lp3-20020a056a003d4300b006e48bbb4be9si2224714pfb.334.2024.02.29.14.22.25 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 14:22:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87634-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=BboKlfR0; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-87634-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87634-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9BC86B22CDB for <ouuuleilei@gmail.com>; Thu, 29 Feb 2024 22:22:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F92774C0E; Thu, 29 Feb 2024 22:22:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="BboKlfR0" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 941AC74BEF; Thu, 29 Feb 2024 22:22:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709245330; cv=none; b=B9uMO04+CItIN/QUPuSpAMjEzudZ6IVu9JRdA7lYkKwbDMde4rce32wTx4y5UAQ+uIqY9p3E6qvXgFKLSkKx3vnHVXjyhd/LXsIeNu3crN8jEx5HdLKC3oVcA4gdxV1RDQqCIRDtpqmW7GlgP788ZCVaG8CjeoY+m/DIDaqwsHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709245330; c=relaxed/simple; bh=x18bamUUPpeftryab9h32Jt2kASCNEMw/tFEjiNtjOw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mcurYwLQaobd8aHYl34efM9ndgraQziRIrmqD5WroNukNJ8D/LtmlP5oowXfxVZDcfTrBzXwGbhDyFBYIg+4tPqD1X0uGy0AhKIZZT6UxWnXK3+FIXKlxnHsPV/dGdy8QI1K/Z7EWRGEPn2zHX/SLdCK7Szco0lq7/qf0TGVLYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=BboKlfR0; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 594DC1BF205; Thu, 29 Feb 2024 22:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709245324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=vXQti813qjlmOLifixiuae4rGnXkl/dZRgzemhLIIuI=; b=BboKlfR0io6uhoSX9M/qXIXMRpbuvsG8ZMbNg98I66b0NOSB14mbHaVQn2B2noqZOXW9GN Jjy4nI02E+iAMD1ECCTRwYTNYFHqSDxq6mDCGWMcAHhzevWvTSJuWMYLIvoMsvIFwOvp6O RFEGJVXRWrJsgMy0GBDH1sOtAgfDKceOJhHXb2dqsd4Hz150sv4rqye/a9UM5pj6j88TmF aem+3qWJPn8mBsfTbH7+RP3jR5S14Ou4Rvwfw5Tvbz51wuTJMXvtpJobkypGc/LojAQKzN iftBgEP+ZeGuJ5suGgi/mGdIgf2Ae2UzNlC+Ek4gMyiWOLtN4OG21a7AA9kOxw== From: alexandre.belloni@bootlin.com To: Avi Fishman <avifishman70@gmail.com>, Tomer Maimon <tmaimon77@gmail.com>, Tali Perry <tali.perry1@gmail.com>, Patrick Venture <venture@google.com>, Nancy Yuen <yuenn@google.com>, Benjamin Fair <benjaminfair@google.com>, Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: kernel test robot <lkp@intel.com>, Dan Carpenter <error27@gmail.com>, openbmc@lists.ozlabs.org, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rtc: nct3018y: fix possible NULL dereference Date: Thu, 29 Feb 2024 23:21:27 +0100 Message-ID: <20240229222127.1878176-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: alexandre.belloni@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792273648165590138 X-GMAIL-MSGID: 1792273648165590138 |
Series |
rtc: nct3018y: fix possible NULL dereference
|
|
Commit Message
Alexandre Belloni
Feb. 29, 2024, 10:21 p.m. UTC
From: Alexandre Belloni <alexandre.belloni@bootlin.com> alarm_enable and alarm_flag are allowed to be NULL but will be dereferenced later by the dev_dbg call. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202305180042.DEzW1pSd-lkp@intel.com/ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> --- drivers/rtc/rtc-nct3018y.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-nct3018y.c b/drivers/rtc/rtc-nct3018y.c index f488a189a465..076d8b99f913 100644 --- a/drivers/rtc/rtc-nct3018y.c +++ b/drivers/rtc/rtc-nct3018y.c @@ -102,6 +102,8 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *ala if (flags < 0) return flags; *alarm_enable = flags & NCT3018Y_BIT_AIE; + dev_dbg(&client->dev, "%s:alarm_enable:%x\n", __func__, *alarm_enable); + } if (alarm_flag) { @@ -110,11 +112,9 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *ala if (flags < 0) return flags; *alarm_flag = flags & NCT3018Y_BIT_AF; + dev_dbg(&client->dev, "%s:alarm_flag:%x\n", __func__, *alarm_flag); } - dev_dbg(&client->dev, "%s:alarm_enable:%x alarm_flag:%x\n", - __func__, *alarm_enable, *alarm_flag); - return 0; }