Fwd: New Defects reported by Coverity Scan for Das U-Boot
Heiko Schocher
hs at nabladev.com
Tue Jan 6 11:03:05 CET 2026
Hello Tom,
On 06.01.26 00:58, Tom Rini wrote:
> ** CID 449815: Memory - illegal accesses (OVERRUN)
> /lib/sm3.c: 252 in sm3_final()
>
>
> _____________________________________________________________________________________________
> *** CID 449815: Memory - illegal accesses (OVERRUN)
> /lib/sm3.c: 252 in sm3_final()
> 246 unsigned int partial = sctx->count % SM3_BLOCK_SIZE;
> 247 u32 W[16];
> 248 int i;
> 249
> 250 sctx->buffer[partial++] = 0x80;
> 251 if (partial > bit_offset) {
>>>> CID 449815: Memory - illegal accesses (OVERRUN)
>>>> Overrunning array of 64 bytes at byte offset 64 by dereferencing pointer "sctx->buffer + partial". [Note: The source code implementation of the function has been overridden by a builtin model.]
> 252 memset(sctx->buffer + partial, 0, SM3_BLOCK_SIZE - partial);
> 253 partial = 0;
> 254
> 255 sm3_block(sctx, sctx->buffer, 1, W);
> 256 }
> 257
>
> ** CID 432237: Null pointer dereferences (NULL_RETURNS)
Good catch, as this part is completly from linux [1]
(nowaydays this code is gone at HEAD)
prepared patch, azure run started for it:
https://dev.azure.com/hs0298/hs/_build/results?buildId=197&view=results
if no problems found, I send it.
bye,
Heiko
[1] https://elixir.bootlin.com/linux/v6.14/source/include/crypto/sm3_base.h#L86
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office at nabladev.com
Geschäftsführer : Stefano Babic
More information about the U-Boot
mailing list