All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>,
	Amitkumar Karwar <amit.karwar@redpinesignals.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Pavani Muthyala <pavani.muthyala@redpinesignals.com>,
	Karun Eagalapati <karun256@gmail.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: rsi: fix integer overflow warning
Date: Fri, 13 Oct 2017 10:00:59 +0000 (UTC)	[thread overview]
Message-ID: <20171013100100.B7A2F605A5@smtp.codeaurora.org> (raw)
In-Reply-To: <20171005120547.328687-1-arnd@arndb.de>

Arnd Bergmann <arnd@arndb.de> wrote:

> gcc produces a harmless warning about a recently introduced
> signed integer overflow:
> 
> drivers/net/wireless/rsi/rsi_91x_hal.c: In function 'rsi_prepare_mgmt_desc':
> include/uapi/linux/swab.h:13:15: error: integer overflow in expression [-Werror=overflow]
>   (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
>    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
> include/uapi/linux/swab.h:104:2: note: in expansion of macro '___constant_swab16'
>   ___constant_swab16(x) :   \
>   ^~~~~~~~~~~~~~~~~~
> include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16'
>  #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
>                                            ^~~~~~~~
> include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16'
>  #define cpu_to_le16 __cpu_to_le16
>                      ^~~~~~~~~~~~~
> drivers/net/wireless/rsi/rsi_91x_hal.c:136:3: note: in expansion of macro 'cpu_to_le16'
>    cpu_to_le16((tx_params->vap_id << RSI_DESC_VAP_ID_OFST) &
>    ^~~~~~~~~~~
> 
> The problem is that the 'mask' value is a signed integer that gets
> turned into a negative number when truncated to 16 bits. Making it
> an unsigned constant avoids this.
> 
> Fixes: eac4eed3224b ("rsi: tx and rx path enhancements for p2p mode")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied to wireless-drivers-next.git, thanks.

a39644b235c1 rsi: fix integer overflow warning

-- 
https://patchwork.kernel.org/patch/9986961/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: Prameela Rani Garnepudi
	<prameela.j04cs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Amitkumar Karwar
	<amit.karwar-MngUzFJYhy7c8hPZMNZi9dBPR1lH4CV8@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	Pavani Muthyala
	<pavani.muthyala-MngUzFJYhy7c8hPZMNZi9dBPR1lH4CV8@public.gmane.org>,
	Karun Eagalapati
	<karun256-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: rsi: fix integer overflow warning
Date: Fri, 13 Oct 2017 10:00:59 +0000 (UTC)	[thread overview]
Message-ID: <20171013100100.B7A2F605A5@smtp.codeaurora.org> (raw)
In-Reply-To: <20171005120547.328687-1-arnd-r2nGTMty4D4@public.gmane.org>

Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:

> gcc produces a harmless warning about a recently introduced
> signed integer overflow:
> 
> drivers/net/wireless/rsi/rsi_91x_hal.c: In function 'rsi_prepare_mgmt_desc':
> include/uapi/linux/swab.h:13:15: error: integer overflow in expression [-Werror=overflow]
>   (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
>    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
> include/uapi/linux/swab.h:104:2: note: in expansion of macro '___constant_swab16'
>   ___constant_swab16(x) :   \
>   ^~~~~~~~~~~~~~~~~~
> include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16'
>  #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
>                                            ^~~~~~~~
> include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16'
>  #define cpu_to_le16 __cpu_to_le16
>                      ^~~~~~~~~~~~~
> drivers/net/wireless/rsi/rsi_91x_hal.c:136:3: note: in expansion of macro 'cpu_to_le16'
>    cpu_to_le16((tx_params->vap_id << RSI_DESC_VAP_ID_OFST) &
>    ^~~~~~~~~~~
> 
> The problem is that the 'mask' value is a signed integer that gets
> turned into a negative number when truncated to 16 bits. Making it
> an unsigned constant avoids this.
> 
> Fixes: eac4eed3224b ("rsi: tx and rx path enhancements for p2p mode")
> Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

Patch applied to wireless-drivers-next.git, thanks.

a39644b235c1 rsi: fix integer overflow warning

-- 
https://patchwork.kernel.org/patch/9986961/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  parent reply	other threads:[~2017-10-13 10:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05 12:05 [PATCH] rsi: fix integer overflow warning Arnd Bergmann
2017-10-05 12:19 ` Joe Perches
2017-10-05 15:12   ` David Laight
2017-10-05 16:11     ` Joe Perches
2017-10-13 10:00 ` Kalle Valo [this message]
2017-10-13 10:00   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171013100100.B7A2F605A5@smtp.codeaurora.org \
    --to=kvalo@codeaurora.org \
    --cc=amit.karwar@redpinesignals.com \
    --cc=arnd@arndb.de \
    --cc=karun256@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pavani.muthyala@redpinesignals.com \
    --cc=prameela.j04cs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.