Re: [PATCH] wifi: nl80211: drop impossible negative band check
From: sun jian
Date: Wed Feb 04 2026 - 06:33:54 EST
On Wed, Feb 4, 2026 at 7:29 PM Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote:
>
> On Wed, 2026-02-04 at 19:21 +0800, sun jian wrote:
> > >
> > > applies _only_ to signed short, not to signed char?
> > Fair point, thanks. I'll drop this patch.
>
> I've thought the better way to address that warning would be to simply
> use 'int' instead of the enum there, but I forgot where the warning even
> appears. I don't think it's generally with gcc/clang, is it?
>
Right, I only saw it from sparse, not from gcc/clang.
It was reported for net/wireless/nl80211.c at the checks around lines
~5762 and ~10539 in my tree (both are "band < 0 || band >=
NUM_NL80211_BANDS" with band coming from nla_type()).
Thanks,
Sun Jian