* [PATCH][next] net: aquantia: fix unintention integer overflow on left shift
@ 2019-10-25 11:58 Colin King
2019-10-28 9:45 ` [EXT] " Igor Russkikh
2019-10-29 17:48 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-10-25 11:58 UTC (permalink / raw)
To: Egor Pomozov, Igor Russkikh, David S . Miller, Dmitry Bezrukov,
Sergey Samoilenko, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Shifting the integer value 1 is evaluated using 32-bit
arithmetic and then used in an expression that expects a 64-bit
value, so there is potentially an integer overflow. Fix this
by using the BIT_ULL macro to perform the shift and avoid the
overflow.
Addresses-Coverity: ("Unintentional integer overflow")
Fixes: 04a1839950d9 ("net: aquantia: implement data PTP datapath")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
index 232df785488c..3eb9d22f7402 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
@@ -713,7 +713,7 @@ static int aq_ptp_poll(struct napi_struct *napi, int budget)
if (work_done < budget) {
napi_complete_done(napi, work_done);
aq_nic->aq_hw_ops->hw_irq_enable(aq_nic->aq_hw,
- 1 << aq_ptp->ptp_ring_param.vec_idx);
+ BIT_ULL(aq_ptp->ptp_ring_param.vec_idx));
}
err_exit:
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [EXT] [PATCH][next] net: aquantia: fix unintention integer overflow on left shift
2019-10-25 11:58 [PATCH][next] net: aquantia: fix unintention integer overflow on left shift Colin King
@ 2019-10-28 9:45 ` Igor Russkikh
2019-10-29 17:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Igor Russkikh @ 2019-10-28 9:45 UTC (permalink / raw)
To: Colin King, Egor Pomozov, Igor Russkikh, David S . Miller,
Dmitry Bezrukov, Sergey Samoilenko, netdev
Cc: kernel-janitors, linux-kernel
> From: Colin Ian King <colin.king@canonical.com>
>
> Shifting the integer value 1 is evaluated using 32-bit
> arithmetic and then used in an expression that expects a 64-bit
> value, so there is potentially an integer overflow. Fix this
> by using the BIT_ULL macro to perform the shift and avoid the
> overflow.
>
> Addresses-Coverity: ("Unintentional integer overflow")
> Fixes: 04a1839950d9 ("net: aquantia: implement data PTP datapath")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Igor Russkikh <irusskikh@marvell.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] net: aquantia: fix unintention integer overflow on left shift
2019-10-25 11:58 [PATCH][next] net: aquantia: fix unintention integer overflow on left shift Colin King
2019-10-28 9:45 ` [EXT] " Igor Russkikh
@ 2019-10-29 17:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-10-29 17:48 UTC (permalink / raw)
To: colin.king
Cc: epomozov, igor.russkikh, dmitry.bezrukov, sergey.samoilenko,
netdev, kernel-janitors, linux-kernel
From: Colin King <colin.king@canonical.com>
Date: Fri, 25 Oct 2019 12:58:11 +0100
> From: Colin Ian King <colin.king@canonical.com>
>
> Shifting the integer value 1 is evaluated using 32-bit
> arithmetic and then used in an expression that expects a 64-bit
> value, so there is potentially an integer overflow. Fix this
> by using the BIT_ULL macro to perform the shift and avoid the
> overflow.
>
> Addresses-Coverity: ("Unintentional integer overflow")
> Fixes: 04a1839950d9 ("net: aquantia: implement data PTP datapath")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-29 17:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 11:58 [PATCH][next] net: aquantia: fix unintention integer overflow on left shift Colin King
2019-10-28 9:45 ` [EXT] " Igor Russkikh
2019-10-29 17:48 ` 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).