Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Bug report - GZ magic check always fails in uImage_gz_load
@ 2024-11-21 14:24 McLaughlin Amy
  2024-12-02 13:05 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: McLaughlin Amy @ 2024-11-21 14:24 UTC (permalink / raw)
  To: kexec@lists.infradead.org

I tried adding -Wextra to Kexec's makefile, while compiling some work by a colleague that built on the kexec source. It spotted the following:

```
kexec/kexec-uImage.c: In function 'uImage_gz_load':
kexec/kexec-uImage.c:160:31: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  160 |  if (buf[0] != 0x1f || buf[1] != 0x8b) {
      |                               ^~
```

With buf being an array of signed char, buf[1] cannot equal 0x8b without a cast, meaning that this function will always return -1 early on. Maybe representing it as an array of uint8_t/unsigned char would have been a better idea?


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

end of thread, other threads:[~2024-12-02 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 14:24 Bug report - GZ magic check always fails in uImage_gz_load McLaughlin Amy
2024-12-02 13:05 ` Simon Horman

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