All of lore.kernel.org
 help / color / mirror / Atom feed
* New sparse warning from min_t(): expression using sizeof(void)
@ 2018-04-21  7:50 Kalle Valo
  2018-04-21  8:24 ` Joey Pabalinas
  0 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2018-04-21  7:50 UTC (permalink / raw)
  To: Kees Cook, Linus Torvalds; +Cc: luciano.coelho, linux-kernel, linux-wireless

Hi Kees&Linus,

after upgrading to v4.17-rc1 I started to see this sparse warning from
min_t():

drivers/net/wireless/ath/ath10k/wmi.c:4620:31: warning: expression using sizeof(void)

I counted 167 such warnings just from ath10k alone and Luca told me that
he sees similar sparse warnings with iwlwifi as well. My sparse is
pretty old (v0.5.0-44-g40791b94c56b) but Luca said updating sparse to
0.5.2 didn't help. I also see this with latest commit from Linus' tree
(83beed7b2b26).

After reverting these two commits the sparse warnings go away:

e9092d0d9796 Fix subtle macro variable shadowing in min_not_zero()
3c8ba0d61d04 kernel.h: Retain constant expression output for max()/min()

I had to revert e9092d0d9796 due to conflicts but it seems 3c8ba0d61d04
is the actual commit causing these warnings.

Is there any way to fix it? With ath10k I use sparse a lot and because
of these warnings sparse is now very annoying to use.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New sparse warning from min_t(): expression using sizeof(void)
  2018-04-21  7:50 New sparse warning from min_t(): expression using sizeof(void) Kalle Valo
@ 2018-04-21  8:24 ` Joey Pabalinas
  2018-04-21  8:54   ` Kalle Valo
  0 siblings, 1 reply; 6+ messages in thread
From: Joey Pabalinas @ 2018-04-21  8:24 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Kees Cook, Linus Torvalds, luciano.coelho, linux-kernel, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

On Sat, Apr 21, 2018 at 10:50:51AM +0300, Kalle Valo wrote:
> Is there any way to fix it? With ath10k I use sparse a lot and because
> of these warnings sparse is now very annoying to use.

I submitted a sparse patch [1] for this not too long ago, but in the
meantime you can still curl the patch [2] and apply it directly to
the v0.5.2 release to suppress the deluge of warnings (-Wpointer-arith
is off by defaultl so no need to change any of you configurations).

[1] https://lkml.org/lkml/2018/4/10/923
[2] https://patchwork.kernel.org/patch/10334353/raw/

-- 
Cheers,
Joey Pabalinas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New sparse warning from min_t(): expression using sizeof(void)
  2018-04-21  8:24 ` Joey Pabalinas
@ 2018-04-21  8:54   ` Kalle Valo
  2018-04-23  6:20     ` Luciano Coelho
  2018-04-23 14:10     ` Kalle Valo
  0 siblings, 2 replies; 6+ messages in thread
From: Kalle Valo @ 2018-04-21  8:54 UTC (permalink / raw)
  To: Joey Pabalinas
  Cc: Kees Cook, Linus Torvalds, luciano.coelho, linux-kernel, linux-wireless

Joey Pabalinas <joeypabalinas@gmail.com> writes:

> On Sat, Apr 21, 2018 at 10:50:51AM +0300, Kalle Valo wrote:
>> Is there any way to fix it? With ath10k I use sparse a lot and because
>> of these warnings sparse is now very annoying to use.
>
> I submitted a sparse patch [1] for this not too long ago, but in the
> meantime you can still curl the patch [2] and apply it directly to
> the v0.5.2 release to suppress the deluge of warnings (-Wpointer-arith
> is off by defaultl so no need to change any of you configurations).
>
> [1] https://lkml.org/lkml/2018/4/10/923
> [2] https://patchwork.kernel.org/patch/10334353/raw/

Perfect, thanks. Unfortunatelly I need to catch a boat and I can't test
it right now, but I'll do that on Monday.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New sparse warning from min_t(): expression using sizeof(void)
  2018-04-21  8:54   ` Kalle Valo
@ 2018-04-23  6:20     ` Luciano Coelho
  2018-04-23  7:41       ` Joey Pabalinas
  2018-04-23 14:10     ` Kalle Valo
  1 sibling, 1 reply; 6+ messages in thread
From: Luciano Coelho @ 2018-04-23  6:20 UTC (permalink / raw)
  To: Kalle Valo, Joey Pabalinas
  Cc: Kees Cook, Linus Torvalds, linux-kernel, linux-wireless

On Sat, 2018-04-21 at 11:54 +0300, Kalle Valo wrote:
> Joey Pabalinas <joeypabalinas@gmail.com> writes:
> 
> > On Sat, Apr 21, 2018 at 10:50:51AM +0300, Kalle Valo wrote:
> > > Is there any way to fix it? With ath10k I use sparse a lot and
> > > because
> > > of these warnings sparse is now very annoying to use.
> > 
> > I submitted a sparse patch [1] for this not too long ago, but in
> > the
> > meantime you can still curl the patch [2] and apply it directly to
> > the v0.5.2 release to suppress the deluge of warnings (-Wpointer-
> > arith
> > is off by defaultl so no need to change any of you configurations).
> > 
> > [1] https://lkml.org/lkml/2018/4/10/923
> > [2] https://patchwork.kernel.org/patch/10334353/raw/
> 
> Perfect, thanks. Unfortunatelly I need to catch a boat and I can't
> test
> it right now, but I'll do that on Monday.

Thanks, this solves the problem for me, but I'm still getting a lot of
this:

./include/linux/mm.h:533:24: warning: constant 0xffffc90000000000 is so big it is unsigned long

Is there a patch in sparse to solve this one as well? Or is this an
actual error that must be fixed in mm.h?

--
Cheers,
Luca.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New sparse warning from min_t(): expression using sizeof(void)
  2018-04-23  6:20     ` Luciano Coelho
@ 2018-04-23  7:41       ` Joey Pabalinas
  0 siblings, 0 replies; 6+ messages in thread
From: Joey Pabalinas @ 2018-04-23  7:41 UTC (permalink / raw)
  To: Luciano Coelho
  Cc: Kalle Valo, Joey Pabalinas, Kees Cook, Linus Torvalds,
	linux-kernel, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]

On Mon, Apr 23, 2018 at 09:20:14AM +0300, Luciano Coelho wrote:
> Thanks, this solves the problem for me, but I'm still getting a lot of
> this:
> 
> ./include/linux/mm.h:533:24: warning: constant 0xffffc90000000000 is so big it is unsigned long
> 
> Is there a patch in sparse to solve this one as well? Or is this an
> actual error that must be fixed in mm.h?

This is definitely a valid warning in the general case (integer promotion
rules can cause *incredibly* difficult to find bugs if you overlook them,
so it's very useful to get a warning when a promotion occurs implicitly to
integer constants).

In this case though, you are comparing it against `unsigned long addr`
which is exactly the same type, so there's no bug.

It could possibly be argued that in:

> arch/x86/include/asm/pgtable_64_types.h:122: # define VMALLOC_START __VMALLOC_BASE_L4
> arch/x86/include/asm/pgtable_64_types.h:108: #define __VMALLOC_BASE_L4 0xffffc90000000000

__VMALLOC_BASE_L4 would be better written as 0xffffc90000000000UL, which would
indeed shut up sparse.

-- 
Cheers,
Joey Pabalinas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New sparse warning from min_t(): expression using sizeof(void)
  2018-04-21  8:54   ` Kalle Valo
  2018-04-23  6:20     ` Luciano Coelho
@ 2018-04-23 14:10     ` Kalle Valo
  1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2018-04-23 14:10 UTC (permalink / raw)
  To: Joey Pabalinas
  Cc: Kees Cook, Linus Torvalds, luciano.coelho, linux-kernel, linux-wireless

Kalle Valo <kvalo@codeaurora.org> writes:

> Joey Pabalinas <joeypabalinas@gmail.com> writes:
>
>> On Sat, Apr 21, 2018 at 10:50:51AM +0300, Kalle Valo wrote:
>>> Is there any way to fix it? With ath10k I use sparse a lot and because
>>> of these warnings sparse is now very annoying to use.
>>
>> I submitted a sparse patch [1] for this not too long ago, but in the
>> meantime you can still curl the patch [2] and apply it directly to
>> the v0.5.2 release to suppress the deluge of warnings (-Wpointer-arith
>> is off by defaultl so no need to change any of you configurations).
>>
>> [1] https://lkml.org/lkml/2018/4/10/923
>> [2] https://patchwork.kernel.org/patch/10334353/raw/
>
> Perfect, thanks. Unfortunatelly I need to catch a boat and I can't test
> it right now, but I'll do that on Monday.

Yes, this fixed my warnings. Thanks!

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-23 14:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-21  7:50 New sparse warning from min_t(): expression using sizeof(void) Kalle Valo
2018-04-21  8:24 ` Joey Pabalinas
2018-04-21  8:54   ` Kalle Valo
2018-04-23  6:20     ` Luciano Coelho
2018-04-23  7:41       ` Joey Pabalinas
2018-04-23 14:10     ` Kalle Valo

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.