diff mbox series

[next] net: atlantic: fix missing | operator when assigning rec->llc

Message ID 20200401232736.410028-1-colin.king@canonical.com
State Accepted
Delegated to: David Miller
Headers show
Series [next] net: atlantic: fix missing | operator when assigning rec->llc | expand

Commit Message

Colin Ian King April 1, 2020, 11:27 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

rec->llc is currently being assigned twice, once with the lower 8 bits
from packed_record[8] and then re-assigned afterwards with data from
packed_record[9].  This looks like a type, I believe the second assignment
should be using the |= operator rather than a direct assignment.

Addresses-Coverity: ("Unused value")
Fixes: b8f8a0b7b5cb ("net: atlantic: MACSec ingress offload HW bindings")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Igor Russkikh April 2, 2020, 11:40 a.m. UTC | #1
Thanks Colin,

We also found this typo recently, but you were ahead of us )

> From: Colin Ian King <colin.king@canonical.com>
> rec->llc is currently being assigned twice, once with the lower 8 bits
> from packed_record[8] and then re-assigned afterwards with data from packed_record[9].  This looks like a type,
>  I believe the second assignment should be using the |= operator rather than a direct assignment.

> Addresses-Coverity: ("Unused value")
> Fixes: b8f8a0b7b5cb ("net: atlantic: MACSec ingress offload HW bindings")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Igor Russkikh <irusskikh@marell.com>
David Miller April 2, 2020, 1:51 p.m. UTC | #2
From: Colin King <colin.king@canonical.com>
Date: Thu,  2 Apr 2020 00:27:36 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> rec->llc is currently being assigned twice, once with the lower 8 bits
> from packed_record[8] and then re-assigned afterwards with data from
> packed_record[9].  This looks like a type, I believe the second assignment
> should be using the |= operator rather than a direct assignment.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: b8f8a0b7b5cb ("net: atlantic: MACSec ingress offload HW bindings")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c b/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c
index 97901c114bfa..fbe9d88b13c7 100644
--- a/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c
+++ b/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c
@@ -491,7 +491,7 @@  get_ingress_preclass_record(struct aq_hw_s *hw,
 	rec->snap[1] = packed_record[8] & 0xFF;
 
 	rec->llc = (packed_record[8] >> 8) & 0xFF;
-	rec->llc = packed_record[9] << 8;
+	rec->llc |= packed_record[9] << 8;
 
 	rec->mac_sa[0] = packed_record[10];
 	rec->mac_sa[0] |= packed_record[11] << 16;