All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: James Prestwood <prestwoj@gmail.com>, iwd@lists.linux.dev
Subject: Re: [PATCH 1/7] wiphy: fix runtime error from bit shift
Date: Fri, 22 Jul 2022 12:04:21 -0500	[thread overview]
Message-ID: <e144ecce-eaad-0156-4f9a-947c0b01b555@gmail.com> (raw)
In-Reply-To: <20220722163417.1119334-1-prestwoj@gmail.com>

Hi James,

On 7/22/22 11:34, James Prestwood wrote:
> The compiler treated the '1' as an int type which was not big enough
> to hold a bit shift of 31. Change this to 1ULL to fix the error:
> 
> runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
> ---
>   src/wiphy.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/wiphy.c b/src/wiphy.c
> index 09b99fb2..4b9e130a 100644
> --- a/src/wiphy.c
> +++ b/src/wiphy.c
> @@ -957,7 +957,7 @@ static void wiphy_print_he_capabilities(struct band *band,
>   	uint8_t width_set = bit_field(he_cap->he_phy_capa[0], 1, 7);
>   
>   	for (i = 0; i < 32; i++) {
> -		if (!(he_cap->iftypes & (1 << i)))
> +		if (!(he_cap->iftypes & (1ULL << i)))

That seems overkill, wouldn't 1U be enough?  Or just make 'i' unsigned?

Have you looked into using wiphy_get_supported_iftypes() here instead?

>   			continue;
>   
>   		if (L_WARN_ON(s >= type_buf + sizeof(type_buf)))

Regards,
-Denis

  parent reply	other threads:[~2022-07-22 17:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 16:34 [PATCH 1/7] wiphy: fix runtime error from bit shift James Prestwood
2022-07-22 16:34 ` [PATCH 2/7] scan: make scan_freq_set const in scan_passive James Prestwood
2022-07-22 16:34 ` [PATCH 3/7] util: add scan_freq_set_remove James Prestwood
2022-07-22 16:34 ` [PATCH 4/7] util: add scan_freq_set_max James Prestwood
2022-07-22 17:41   ` Denis Kenzior
2022-07-22 18:19     ` James Prestwood
2022-07-22 16:34 ` [PATCH 5/7] manager: re-dump wiphy on regulatory change James Prestwood
2022-07-22 17:38   ` Denis Kenzior
2022-07-22 18:18     ` James Prestwood
2022-07-22 16:34 ` [PATCH 6/7] wiphy: track disabled frequencies on multiple dumps James Prestwood
2022-07-22 18:08   ` Denis Kenzior
2022-07-22 16:34 ` [PATCH 7/7] station: do full passive scan if 6GHz is supported but disabled James Prestwood
2022-07-22 17:04 ` Denis Kenzior [this message]
2022-07-22 18:21   ` [PATCH 1/7] wiphy: fix runtime error from bit shift James Prestwood

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=e144ecce-eaad-0156-4f9a-947c0b01b555@gmail.com \
    --to=denkenz@gmail.com \
    --cc=iwd@lists.linux.dev \
    --cc=prestwoj@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.