linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index
@ 2019-08-30  9:07 Colin King
  2019-08-30 11:40 ` Dan Carpenter
  2019-08-30 19:32 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-08-30  9:07 UTC (permalink / raw)
  To: Inaky Perez-Gonzalez, linux-wimax, David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The subtraction of the two pointers is automatically scaled by the
size of the size of the object the pointers point to, so the division
by sizeof(*i2400m->barker) is incorrect.  This has been broken since
day one of the driver and is only debug, so remove the debug completely.

Also move && in condition to clean up a checkpatch warning.

Addresses-Coverity: ("Extra sizeof expression")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---

V2: completely remove debug, clean up checkpatch warning, change subject line

---
 drivers/net/wimax/i2400m/fw.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
index 489cba9b284d..6c9a41bff2e0 100644
--- a/drivers/net/wimax/i2400m/fw.c
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -397,14 +397,9 @@ int i2400m_is_boot_barker(struct i2400m *i2400m,
 
 	/* Short circuit if we have already discovered the barker
 	 * associated with the device. */
-	if (i2400m->barker
-	    && !memcmp(buf, i2400m->barker, sizeof(i2400m->barker->data))) {
-		unsigned index = (i2400m->barker - i2400m_barker_db)
-			/ sizeof(*i2400m->barker);
-		d_printf(2, dev, "boot barker cache-confirmed #%u/%08x\n",
-			 index, le32_to_cpu(i2400m->barker->data[0]));
+	if (i2400m->barker &&
+	    !memcmp(buf, i2400m->barker, sizeof(i2400m->barker->data)))
 		return 0;
-	}
 
 	for (i = 0; i < i2400m_barker_db_used; i++) {
 		barker = &i2400m_barker_db[i];
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index
  2019-08-30  9:07 [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index Colin King
@ 2019-08-30 11:40 ` Dan Carpenter
  2019-08-30 19:32 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-08-30 11:40 UTC (permalink / raw)
  To: Colin King
  Cc: Inaky Perez-Gonzalez, linux-wimax, David S . Miller, netdev,
	kernel-janitors, linux-kernel

On Fri, Aug 30, 2019 at 10:07:11AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The subtraction of the two pointers is automatically scaled by the
> size of the size of the object the pointers point to, so the division
> by sizeof(*i2400m->barker) is incorrect.  This has been broken since
> day one of the driver and is only debug, so remove the debug completely.
> 
> Also move && in condition to clean up a checkpatch warning.
> 
> Addresses-Coverity: ("Extra sizeof expression")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index
  2019-08-30  9:07 [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index Colin King
  2019-08-30 11:40 ` Dan Carpenter
@ 2019-08-30 19:32 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-08-30 19:32 UTC (permalink / raw)
  To: colin.king
  Cc: inaky.perez-gonzalez, linux-wimax, netdev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Fri, 30 Aug 2019 10:07:11 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> The subtraction of the two pointers is automatically scaled by the
> size of the size of the object the pointers point to, so the division
> by sizeof(*i2400m->barker) is incorrect.  This has been broken since
> day one of the driver and is only debug, so remove the debug completely.
> 
> Also move && in condition to clean up a checkpatch warning.
> 
> Addresses-Coverity: ("Extra sizeof expression")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 
> V2: completely remove debug, clean up checkpatch warning, change subject line

Applied to net-next, thanks Colin.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-30 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30  9:07 [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index Colin King
2019-08-30 11:40 ` Dan Carpenter
2019-08-30 19:32 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).