diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2011-11-02 22:07:39 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-11-02 22:07:39 +0100 |
commit | 99f6e521592f06e7db0a2069c270dd6f9a5e2e89 (patch) | |
tree | 982a36536fabb4ffac2e2182f219388229a67428 /sysfs.c | |
parent | mdstat_read(): Check return value of dup() before using file descriptor (diff) | |
download | mdadm-99f6e521592f06e7db0a2069c270dd6f9a5e2e89.tar.xz mdadm-99f6e521592f06e7db0a2069c270dd6f9a5e2e89.zip |
get_component_size(): Check read() return value for error before using it
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'sysfs.c')
-rw-r--r-- | sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -379,7 +379,7 @@ unsigned long long get_component_size(int fd) return 0; n = read(fd, fname, sizeof(fname)); close(fd); - if (n == sizeof(fname)) + if (n < 0 || n == sizeof(fname)) return 0; fname[n] = 0; return strtoull(fname, NULL, 10) * 2; |