public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* linux-6.14/arch/arm64/lib/crc-t10dif-glue.c bug report
@ 2025-03-26 19:12 David Binderman
  2025-03-26 20:11 ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2025-03-26 19:12 UTC (permalink / raw)
  To: ebiggers@kernel.org, ardb@kernel.org, catalin.marinas@arm.com,
	will@kernel.org, linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List

Hello there,

Static analyser cppcheck says:

 linux-6.14/arch/arm64/lib/crc-t10dif-glue.c:53:33: error: Using pointer to local variable 'buf' that is out of scope. [invalidLifetime]

Source code is

    return crc_t10dif_generic(crc, data, length);

but this line

            data = buf;

looks very suspicious. Suggest move local variable buf out
to file scope.

Regards

David Binderman


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

* Re: linux-6.14/arch/arm64/lib/crc-t10dif-glue.c bug report
  2025-03-26 19:12 linux-6.14/arch/arm64/lib/crc-t10dif-glue.c bug report David Binderman
@ 2025-03-26 20:11 ` Eric Biggers
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2025-03-26 20:11 UTC (permalink / raw)
  To: David Binderman
  Cc: ardb@kernel.org, catalin.marinas@arm.com, will@kernel.org,
	linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List

On Wed, Mar 26, 2025 at 07:12:00PM +0000, David Binderman wrote:
> Hello there,
> 
> Static analyser cppcheck says:
> 
>  linux-6.14/arch/arm64/lib/crc-t10dif-glue.c:53:33: error: Using pointer to local variable 'buf' that is out of scope. [invalidLifetime]
> 
> Source code is
> 
>     return crc_t10dif_generic(crc, data, length);
> 
> but this line
> 
>             data = buf;
> 
> looks very suspicious. Suggest move local variable buf out
> to file scope.
> 
> Regards
> 
> David Binderman

Thanks for finding this!  Kind of a silly bug, but that's what we get for
programming in C...
https://lore.kernel.org/r/20250326200812.125574-1-ebiggers@kernel.org and
https://lore.kernel.org/r/20250326200918.125743-1-ebiggers@kernel.org fix this
for arm and arm64.

- Eric


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

end of thread, other threads:[~2025-03-26 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26 19:12 linux-6.14/arch/arm64/lib/crc-t10dif-glue.c bug report David Binderman
2025-03-26 20:11 ` Eric Biggers

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