[dm-devel] [PATCH 12/42] Valgrind fixes for prioritizer
Hannes Reinecke
hare at suse.de
Tue Jan 8 13:53:50 UTC 2013
Declaring an array does not zero out its contents. So we might
be reading random garbage here.
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
libmultipath/prioritizers/hds.c | 1 +
libmultipath/prioritizers/ontap.c | 1 +
libmultipath/prioritizers/rdac.c | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c
index b22e1df..5d75f84 100644
--- a/libmultipath/prioritizers/hds.c
+++ b/libmultipath/prioritizers/hds.c
@@ -105,6 +105,7 @@ int hds_modular_prio (const char *dev, int fd)
}
memset (&io_hdr, 0, sizeof (sg_io_hdr_t));
+ memset (inqBuff, 0, INQ_REPLY_LEN);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
io_hdr.mx_sb_len = sizeof (sense_buffer);
diff --git a/libmultipath/prioritizers/ontap.c b/libmultipath/prioritizers/ontap.c
index 0d34092..026d45d 100644
--- a/libmultipath/prioritizers/ontap.c
+++ b/libmultipath/prioritizers/ontap.c
@@ -80,6 +80,7 @@ static int send_gva(const char *dev, int fd, unsigned char pg,
int ret = -1;
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(results, 0, *results_size);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (cdb);
io_hdr.mx_sb_len = sizeof (sb);
diff --git a/libmultipath/prioritizers/rdac.c b/libmultipath/prioritizers/rdac.c
index 8667790..441b3b0 100644
--- a/libmultipath/prioritizers/rdac.c
+++ b/libmultipath/prioritizers/rdac.c
@@ -22,6 +22,7 @@ int rdac_prio(const char *dev, int fd)
int ret = 0;
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(sense_buffer, 0, 256);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
io_hdr.mx_sb_len = sizeof (sb);
--
1.7.4.2
More information about the dm-devel
mailing list