All of lore.kernel.org
 help / color / mirror / Atom feed
* number conversion in lvm
@ 2013-07-12 23:11 Mikulas Patocka
  2013-07-13  8:49 ` Zdenek Kabelac
  0 siblings, 1 reply; 5+ messages in thread
From: Mikulas Patocka @ 2013-07-12 23:11 UTC (permalink / raw)
  To: lvm-devel

Hi

I found some strange code in _get_int_arg in ./tools/lvmcmdline.c:

v = strtol(val, ptr, 10);

if (*ptr == val)
        return 0;

av->i_value = (int32_t) v;
av->ui_value = (uint32_t) v;
av->i64_value = (int64_t) v;
av->ui64_value = (uint64_t) v;

It is taking 32-bit long value and then casting it to 64 bits. Should 
there be strtoull instead of strtol?

BTW. how is that function supposed to handle integer overflow - it doesn't 
seem to do that.

Mikulas



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

end of thread, other threads:[~2013-07-15 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-12 23:11 number conversion in lvm Mikulas Patocka
2013-07-13  8:49 ` Zdenek Kabelac
2013-07-15 20:10   ` Mikulas Patocka
2013-07-15 20:22     ` Zdenek Kabelac
2013-07-15 20:27       ` Mikulas Patocka

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.