j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: Sun Aug 8 20:50:22 2010 New Revision: 842 URL: http://tracker.coreboot.org/trac/openbios/changeset/842
Log: Add checks for open_ih() return value
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/fs/ext2/ext2_fs.c trunk/openbios-devel/fs/grubfs/grubfs_fs.c trunk/openbios-devel/fs/hfs/hfs_fs.c trunk/openbios-devel/fs/hfsplus/hfsp_fs.c trunk/openbios-devel/fs/iso9660/iso9660_fs.c
Modified: trunk/openbios-devel/fs/ext2/ext2_fs.c ============================================================================== --- trunk/openbios-devel/fs/ext2/ext2_fs.c Sun Aug 8 20:28:48 2010 (r841) +++ trunk/openbios-devel/fs/ext2/ext2_fs.c Sun Aug 8 20:50:22 2010 (r842) @@ -267,10 +267,14 @@ int fd, ret = 0;
fd = open_ih(ih); - if (ext2_probe(fd, offs)) - ret = -1; - - close_io(fd); + if (fd >= 0) { + if (ext2_probe(fd, offs)) { + ret = -1; + } + close_io(fd); + } else { + ret = -1; + }
RET (ret); }
Modified: trunk/openbios-devel/fs/grubfs/grubfs_fs.c ============================================================================== --- trunk/openbios-devel/fs/grubfs/grubfs_fs.c Sun Aug 8 20:28:48 2010 (r841) +++ trunk/openbios-devel/fs/grubfs/grubfs_fs.c Sun Aug 8 20:50:22 2010 (r842) @@ -336,6 +336,9 @@ int i;
curfs->dev_fd = open_ih(ih); + if (curfs->dev_fd == -1) { + RET( -1 ); + } curfs->offset = offs;
for (i = 0; i < sizeof(fsys_table)/sizeof(fsys_table[0]); i++) {
Modified: trunk/openbios-devel/fs/hfs/hfs_fs.c ============================================================================== --- trunk/openbios-devel/fs/hfs/hfs_fs.c Sun Aug 8 20:28:48 2010 (r841) +++ trunk/openbios-devel/fs/hfs/hfs_fs.c Sun Aug 8 20:50:22 2010 (r842) @@ -479,8 +479,12 @@ char *volname = malloc(VOLNAME_SIZE);
fd = open_ih(my_self()); - get_hfs_vol_name(fd, volname, VOLNAME_SIZE); - close_io(fd); + if (fd >= 0) { + get_hfs_vol_name(fd, volname, VOLNAME_SIZE); + close_io(fd); + } else { + volname[0] = '\0'; + }
PUSH ((ucell)volname); } @@ -546,10 +550,14 @@ int fd, ret = 0;
fd = open_ih(ih); - if (hfs_probe(fd, offs)) - ret = -1; - - close_io(fd); + if (fd >= 0) { + if (hfs_probe(fd, offs)) { + ret = -1; + } + close_io(fd); + } else { + ret = -1; + }
RET (ret); }
Modified: trunk/openbios-devel/fs/hfsplus/hfsp_fs.c ============================================================================== --- trunk/openbios-devel/fs/hfsplus/hfsp_fs.c Sun Aug 8 20:28:48 2010 (r841) +++ trunk/openbios-devel/fs/hfsplus/hfsp_fs.c Sun Aug 8 20:50:22 2010 (r842) @@ -427,8 +427,12 @@ char *volname = malloc(VOLNAME_SIZE);
fd = open_ih(my_self()); - get_hfs_vol_name(fd, volname, VOLNAME_SIZE); - close_io(fd); + if (fd >= 0) { + get_hfs_vol_name(fd, volname, VOLNAME_SIZE); + close_io(fd); + } else { + volname[0] = '\0'; + }
PUSH ((ucell)volname); } @@ -452,10 +456,14 @@ int fd, ret = 0;
fd = open_ih(ih); - if (volume_probe(fd, offs)) - ret = -1; - - close_io(fd); + if (fd >= 0) { + if (volume_probe(fd, offs)) { + ret = -1; + } + close_io(fd); + } else { + ret = -1; + }
RET (ret); }
Modified: trunk/openbios-devel/fs/iso9660/iso9660_fs.c ============================================================================== --- trunk/openbios-devel/fs/iso9660/iso9660_fs.c Sun Aug 8 20:28:48 2010 (r841) +++ trunk/openbios-devel/fs/iso9660/iso9660_fs.c Sun Aug 8 20:50:22 2010 (r842) @@ -219,10 +219,14 @@ int fd, ret = 0;
fd = open_ih(ih); - if (iso9660_probe(fd, offs)) - ret = -1; - - close_io(fd); + if (fd >= 0) { + if (iso9660_probe(fd, offs)) { + ret = -1; + } + close_io(fd); + } else { + ret = -1; + }
RET (ret); }