Smatch (Semantic Matching Tool) development
 help / color / mirror / Atom feed
* smatch, __builtin_unreachable() and uninitialized var...
@ 2025-11-17  9:50 Toomas Soome
  2025-11-18 11:14 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Toomas Soome @ 2025-11-17  9:50 UTC (permalink / raw)
  To: smatch

hi!

While using smatch with OpenZFS code, we have stepped on this issue:

/home/runner/work/zfs/zfs/zfs/module/icp/algs/aes/aes_modes.c:90 aes_encrypt_contiguous_blocks() error: uninitialized symbol 'rv'.


The function is using conditional call to function, which return value is stored to rv and the “impossible” else leg is marked with __builtin_unreachable() as seen there:

https://github.com/openzfs/zfs/blob/master/module/icp/algs/aes/aes_modes.c#L77

it would be nice if smatch could use __builtin_unreachable() there to avoid this error…

thanks,
toomas



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

* Re: smatch, __builtin_unreachable() and uninitialized var...
  2025-11-17  9:50 smatch, __builtin_unreachable() and uninitialized var Toomas Soome
@ 2025-11-18 11:14 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2025-11-18 11:14 UTC (permalink / raw)
  To: Toomas Soome; +Cc: smatch

On Mon, Nov 17, 2025 at 11:50:42AM +0200, Toomas Soome wrote:
> hi!
> 
> While using smatch with OpenZFS code, we have stepped on this issue:
> 
> /home/runner/work/zfs/zfs/zfs/module/icp/algs/aes/aes_modes.c:90 aes_encrypt_contiguous_blocks() error: uninitialized symbol 'rv'.
> 
> 
> The function is using conditional call to function, which return value is stored to rv and the “impossible” else leg is marked with __builtin_unreachable() as seen there:
> 
> https://github.com/openzfs/zfs/blob/master/module/icp/algs/aes/aes_modes.c#L77
> 
> it would be nice if smatch could use __builtin_unreachable() there to avoid this error…
> 

Huh.  Surprising that I've never noticed that before.  I have fixed this
locally and will push the change after testing it tonight.  (I emailed the
Sparse developers to see if they want to change it in their code as well,
but either way I will update Smatch).

Thanks for the bug report.

regards,
dan carpenter

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

end of thread, other threads:[~2025-11-18 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17  9:50 smatch, __builtin_unreachable() and uninitialized var Toomas Soome
2025-11-18 11:14 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox