[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANeU7Qkpg3_mYEYqZpT2zy__6z0q8KDNB=gDH9oMY8UtQNu0+Q@mail.gmail.com>
Date: Sat, 10 May 2014 02:09:52 -0700
From: Christopher Li <sparse@...isli.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Martin Kepplinger <martink@...teo.de>,
Greg KH <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org,
linux-kernel <linux-kernel@...r.kernel.org>,
burzalodowa@...il.com, Linux-Sparse <linux-sparse@...r.kernel.org>
Subject: Re: [PATCH] staging: rtl8192u: initialize array in C compliant way
On Tue, May 6, 2014 at 1:47 AM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
>> diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
>> index 426f223..c96dbab 100644
>> --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
>> +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
>> @@ -241,7 +241,7 @@ static PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee,
>> {
>> //DIRECTION_VALUE dir;
>> u8 dir;
>> - bool search_dir[4] = {0, 0, 0, 0};
>> + bool search_dir[4] = {0};
>
> That's weird. The original code is valid but it generates a sparse
> warning.
Sorry for the late reply. I see what is going on already. The bits_to_bytes()
function is buggy for bool type. Bool is the only type has bits less than 8.
It truncates the bool byte size to 0. As a result, the array layout function
convert_index() always set the expr->init_offset to 0 for bool type:
"e->init_offset = from * bits_to_bytes(e->ctype->bit_size);"
Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists