Re: [PATCH V4] staging: rtl8192e: Fix signedness bug in rtllib_rx_assoc_resp()

From: Dan Carpenter
Date: Fri Apr 15 2022 - 02:58:46 EST


On Fri, Apr 15, 2022 at 02:39:27PM +0800, Haowen Bai wrote:
> This commit message suggested by Dan Carpenter as below:

You don't need to add this. If you feel you must then put it below the
--- cut off line and it will be stored on lore.kernel.org until the end
of time.

> @@ -2292,8 +2298,8 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb)
> if (errcode) {
> ieee->softmac_stats.rx_auth_rs_err++;
> netdev_info(ieee->dev,
> - "Authentication response status code 0x%x",
> - errcode);
> + "Authentication response status code %d",
> + le16_to_cpu(errcode));

The error code is not a le16. It's just an int. The way to prevent
these kinds of issues in the future is to run Sparse with the endian
checking enabled.

https://lwn.net/Articles/205624/

regards,
dan carpenter