net: aquantia: fix unintention integer overflow on left shift
Subsystems (5)
PATCH 1/1 net: aquantia: fix unintention integer overflow on left shift
From: Colin Ian King <[email protected]>
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")
--- drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_ptp.c +1 -1
@@ -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:
Signature · 1 line
2.20.1
DQo+IEZyb206IENvbGluIElhbiBLaW5nIDxjb2xpbi5raW5nQGNhbm9uaWNhbC5jb20+DQo+IA0K PiBTaGlmdGluZyB0aGUgaW50ZWdlciB2YWx1ZSAxIGlzIGV2YWx1YXRlZCB1c2luZyAzMi1iaXQN Cj4gYXJpdGhtZXRpYyBhbmQgdGhlbiB1c2VkIGluIGFuIGV4cHJlc3Npb24gdGhhdCBleHBlY3Rz IGEgNjQtYml0DQo+IHZhbHVlLCBzbyB0aGVyZSBpcyBwb3RlbnRpYWxseSBhbiBpbnRlZ2VyIG92 ZXJmbG93LiBGaXggdGhpcw0KPiBieSB1c2luZyB0aGUgQklUX1VMTCBtYWNybyB0byBwZXJmb3Jt IHRoZSBzaGlmdCBhbmQgYXZvaWQgdGhlDQo+IG92ZXJmbG93Lg0KPiANCj4gQWRkcmVzc2VzLUNv dmVyaXR5OiAoIlVuaW50ZW50aW9uYWwgaW50ZWdlciBvdmVyZmxvdyIpDQo+IEZpeGVzOiAwNGEx ODM5OTUwZDkgKCJuZXQ6IGFxdWFudGlhOiBpbXBsZW1lbnQgZGF0YSBQVFAgZGF0YXBhdGgiKQ0K PiBTaWduZWQtb2ZmLWJ5OiBDb2xpbiBJYW4gS2luZyA8Y29saW4ua2luZ0BjYW5vbmljYWwuY29t Pg0KDQpSZXZpZXdlZC1ieTogSWdvciBSdXNza2lraCA8aXJ1c3NraWtoQG1hcnZlbGwuY29tPg0K DQo
From: Colin King <[email protected]>
Date: Fri, 25 Oct 2019 12:58:11 +0100
Quoted 11 lines
From: Colin Ian King <[email protected]>
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_ULLmacro 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 <[email protected]>
Applied.