netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] ixgbe: fix comparison of offset with zero or NVM_INVALID_PTR
@ 2018-01-12 17:13 Colin King
  2018-01-12 17:52 ` Jeff Kirsher
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-01-12 17:13 UTC (permalink / raw)
  To: Jeff Kirsher, intel-wired-lan, netdev; +Cc: kernel-janitors, linux-kernel

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

The incorrect operator && is being used and will always return false
as offset can never be two different values at the same time. Fix this
by using the || operator instead.

Detected by CoverityScan, CID#1463806 ("Logically dead code")

Fixes: 73834aec7199 ("ixgbe: extend firmware version support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index 1948e4208fb4..27de8a7f2aeb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -4084,7 +4084,7 @@ void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw,
 	hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, &offset);
 
 	/* Return is offset to OEM Product Version block is invalid */
-	if (offset == 0x0 && offset == NVM_INVALID_PTR)
+	if (offset == 0x0 || offset == NVM_INVALID_PTR)
 		return;
 
 	/* Read product version block */
-- 
2.15.1

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

* Re: [PATCH][next] ixgbe: fix comparison of offset with zero or NVM_INVALID_PTR
  2018-01-12 17:13 [PATCH][next] ixgbe: fix comparison of offset with zero or NVM_INVALID_PTR Colin King
@ 2018-01-12 17:52 ` Jeff Kirsher
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Kirsher @ 2018-01-12 17:52 UTC (permalink / raw)
  To: Colin King, intel-wired-lan, netdev
  Cc: kernel-janitors, linux-kernel, Dan Carpenter

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

On Fri, 2018-01-12 at 17:13 +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The incorrect operator && is being used and will always return false
> as offset can never be two different values at the same time. Fix
> this
> by using the || operator instead.
> 
> Detected by CoverityScan, CID#1463806 ("Logically dead code")
> 
> Fixes: 73834aec7199 ("ixgbe: extend firmware version support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Dan Carpenter beat you too it, see his patch in my tree:

commit 7352baadcc2ad2ed214e52bd8b50ac6eb01968cd
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Fri Jan 12 09:45:00 2018 -0800

    ixgbe: Fix && vs || typo
    
    "offset" can't be both 0x0 and 0xFFFF so presumably || was intended
    instead of &&.  That matches with how this check is done in other
    functions.
    
    Fixes: 73834aec7199 ("ixgbe: extend firmware version support")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-01-12 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 17:13 [PATCH][next] ixgbe: fix comparison of offset with zero or NVM_INVALID_PTR Colin King
2018-01-12 17:52 ` Jeff Kirsher

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).