All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libblkid: fix overflow in implicit constant conversion
@ 2017-12-17  6:45 Sami Kerola
  2017-12-18 12:08 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Sami Kerola @ 2017-12-17  6:45 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 libblkid/src/superblocks/bcache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c
index 82c1a8008..f9273b97a 100644
--- a/libblkid/src/superblocks/bcache.c
+++ b/libblkid/src/superblocks/bcache.c
@@ -10,6 +10,7 @@
 
 #include <stddef.h>
 #include <stdio.h>
+#include <stdint.h>
 
 #include "superblocks.h"
 
@@ -19,7 +20,7 @@
 #define node(i, j)         ((i)->d + (j))
 #define end(i)             node(i, le16_to_cpu((i)->keys))
 
-static const char bcache_magic[] = {
+static const uint8_t bcache_magic[] = {
 	0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
 	0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81
 };
-- 
2.15.1


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

* Re: [PATCH] libblkid: fix overflow in implicit constant conversion
  2017-12-17  6:45 [PATCH] libblkid: fix overflow in implicit constant conversion Sami Kerola
@ 2017-12-18 12:08 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2017-12-18 12:08 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Dec 17, 2017 at 06:45:50AM +0000, Sami Kerola wrote:
> -static const char bcache_magic[] = {
> +static const uint8_t bcache_magic[] = {
>  	0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
>  	0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81
>  };

Well, libblkid assumes magic number as a string, and it seems we do
not need the variable bcache_magic[] in the code at all. So I have
committed:

    -#define BCACHE_SB_MAGIC     bcache_magic
    +#define BCACHE_SB_MAGIC     "\xc6\x85\x73\xf6\x4e\x1a\x45\xca\x82\x65\xf5\x7f\x48\xba\x6d\x81"

etc.

  Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

end of thread, other threads:[~2017-12-18 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-17  6:45 [PATCH] libblkid: fix overflow in implicit constant conversion Sami Kerola
2017-12-18 12:08 ` Karel Zak

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.