diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2016-03-04 22:00:21 +0100 |
---|---|---|
committer | Jes Sorensen <Jes.Sorensen@redhat.com> | 2016-03-09 17:35:34 +0100 |
commit | 193b6c0b26e2a722691ab7d8f67604429b0c9ac6 (patch) | |
tree | a81ce2851e83adb16dc051cf1c1bccd17467503c /Detail.c | |
parent | Manage: Manage_add(): Fix potential NULL pointer dereference (diff) | |
download | mdadm-193b6c0b26e2a722691ab7d8f67604429b0c9ac6.tar.xz mdadm-193b6c0b26e2a722691ab7d8f67604429b0c9ac6.zip |
load_sys(): Add a buffer size argument
This adds a buffer size argument to load_sys(), rather than relying on
a hard coded buffer size. The old behavior was safe because we knew
the kernel would never return strings overrunning the buffers, however
it was ugly, and would cause code checking tools to spit out warnings.
This caused a Coverity warning over the read into
sra->sysfs_array_state which is only 20 bytes.
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Diffstat (limited to 'Detail.c')
-rw-r--r-- | Detail.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -582,7 +582,7 @@ This is pretty boring continue; sprintf(path, "/sys/block/%s/md/metadata_version", de->d_name); - if (load_sys(path, vbuf) < 0) + if (load_sys(path, vbuf, sizeof(vbuf)) < 0) continue; if (strncmp(vbuf, "external:", 9) != 0 || !is_subarray(vbuf+9) || |