In lib/wholedisk.c, i is set to 0. If fd was a -1, then at
line 18 geometry.start is used without it being initialized.
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
int is_whole_disk_fd(int fd, const char *name)
{
#ifdef HDIO_GETGEO
- struct hd_geometry geometry;
- int i = 0;
-
- if (fd != -1)
- i = ioctl(fd, HDIO_GETGEO, &geometry);
- if (i == 0)
- return geometry.start == 0;
+ if (fd != -1) {
+ struct hd_geometry geometry;
+ int i = ioctl(fd, HDIO_GETGEO, &geometry);
+ if (i == 0)
+ return geometry.start == 0;
+ }
#endif
/*
* The "silly heuristic" is still sexy for us, because