[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20170604.195815.1578427347580474114.davem@davemloft.net>
Date: Sun, 04 Jun 2017 19:58:15 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: colin.king@...onical.com
Cc: peppe.cavallaro@...com, alexandre.torgue@...com,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: stmmac: ensure jumbo_frm error return is
correctly checked for -ve value
From: Colin King <colin.king@...onical.com>
Date: Fri, 2 Jun 2017 15:58:27 +0100
> From: Colin Ian King <colin.king@...onical.com>
>
> The current comparison of entry < 0 will never be true since entry is an
> unsigned integer. Cast entry to an int to ensure -ve error return values
> from the call to jumbo_frm are correctly being caught.
>
> Detected by CoverityScan, CID#1238760 ("Macro compares unsigned to 0")
>
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
Like others have suggested, probably making 'entry' signed is
a better fix.
I was initially worried that STMMAC_GET_ENTRY() might become
more expensive if it was implemented using '%' but it is using
'and' masking instead which doesn't have that kind of problem.
Powered by blists - more mailing lists