From: Rand Deeb <rand.sec96@gmail.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>,
openbmc@lists.ozlabs.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: deeb.rand@confident.ru, lvc-project@linuxtesting.org,
voskresenski.stanislav@confident.ru,
Rand Deeb <rand.sec96@gmail.com>
Subject: [PATCH] i2c: Remove redundant comparison in npcm_i2c_reg_slave
Date: Tue, 6 Feb 2024 22:42:01 +0300 [thread overview]
Message-ID: <20240206194201.10054-1-rand.sec96@gmail.com> (raw)
In the npcm_i2c_reg_slave() function, there was a redundant
comparison that checked if 'bus->slave' was null immediately after
assigning it the 'client' value. There were concerns about a
potential null dereference because of `client->adapter`, but
according to Wolfram Sang, "we trusted ourselves here" Therefore,
this comparison is unnecessary.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
---
drivers/i2c/busses/i2c-npcm7xx.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index c1b679737240..bdf35b86e559 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -1247,9 +1247,6 @@ static int npcm_i2c_reg_slave(struct i2c_client *client)
bus->slave = client;
- if (!bus->slave)
- return -EINVAL;
-
if (client->flags & I2C_CLIENT_TEN)
return -EAFNOSUPPORT;
--
2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Rand Deeb <rand.sec96@gmail.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>,
openbmc@lists.ozlabs.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: voskresenski.stanislav@confident.ru, deeb.rand@confident.ru,
lvc-project@linuxtesting.org, Rand Deeb <rand.sec96@gmail.com>
Subject: [PATCH] i2c: Remove redundant comparison in npcm_i2c_reg_slave
Date: Tue, 6 Feb 2024 22:42:01 +0300 [thread overview]
Message-ID: <20240206194201.10054-1-rand.sec96@gmail.com> (raw)
In the npcm_i2c_reg_slave() function, there was a redundant
comparison that checked if 'bus->slave' was null immediately after
assigning it the 'client' value. There were concerns about a
potential null dereference because of `client->adapter`, but
according to Wolfram Sang, "we trusted ourselves here" Therefore,
this comparison is unnecessary.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
---
drivers/i2c/busses/i2c-npcm7xx.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index c1b679737240..bdf35b86e559 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -1247,9 +1247,6 @@ static int npcm_i2c_reg_slave(struct i2c_client *client)
bus->slave = client;
- if (!bus->slave)
- return -EINVAL;
-
if (client->flags & I2C_CLIENT_TEN)
return -EAFNOSUPPORT;
--
2.34.1
next reply other threads:[~2024-02-06 19:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 19:42 Rand Deeb [this message]
2024-02-06 19:42 ` [PATCH] i2c: Remove redundant comparison in npcm_i2c_reg_slave Rand Deeb
2024-02-06 19:52 ` Wolfram Sang
2024-02-06 19:52 ` Wolfram Sang
2024-02-14 22:25 ` Andi Shyti
2024-02-14 22:25 ` Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240206194201.10054-1-rand.sec96@gmail.com \
--to=rand.sec96@gmail.com \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=deeb.rand@confident.ru \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=openbmc@lists.ozlabs.org \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=voskresenski.stanislav@confident.ru \
--cc=yuenn@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.