Re: [PATCH v3] ethtool: avoiding integer overflow in ethtool_phys_id()

From: Andrew Lunn
Date: Tue Nov 22 2022 - 09:51:02 EST


On Tue, Nov 22, 2022 at 03:29:01PM +0300, Maxim Korotkov wrote:
> The value of an arithmetic expression "n * id.data" is subject
> to possible overflow due to a failure to cast operands to a larger data
> type before performing arithmetic. Used macro for multiplication instead
> operator for avoiding overflow.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Maxim Korotkov <korotkov.maxim.s@xxxxxxxxx>

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew