libmultipath: zero out sense buffer in do_inq()
authorHannes Reinecke <hare@suse.de>
Wed, 18 May 2011 07:24:29 +0000 (09:24 +0200)
committerHannes Reinecke <hare@suse.de>
Wed, 18 May 2011 07:24:29 +0000 (09:24 +0200)
We should be zero out the sense buffer when doing an inquiry
so as not to have invalid contents being passed up.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/discovery.c

index b5e2e4f..a7a8e94 100644 (file)
@@ -346,6 +346,7 @@ do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op,
        inqCmdBlk[3] = (unsigned char)((mx_resp_len >> 8) & 0xff);
        inqCmdBlk[4] = (unsigned char) (mx_resp_len & 0xff);
        memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+       memset(sense_b, 0, SENSE_BUFF_LEN);
        io_hdr.interface_id = 'S';
        io_hdr.cmd_len = sizeof (inqCmdBlk);
        io_hdr.mx_sb_len = sizeof (sense_b);