diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2013-03-05 15:18:20 +0000 |
---|---|---|
committer | Junfeng Dong <junfeng.dong@intel.com> | 2013-11-19 18:57:39 +0800 |
commit | f5ec14808631699b99660728a00b5454ab4a545e (patch) | |
tree | 12634f04000fd8a25f0fbf812e18356022c2daa0 | |
parent | c880d3fbc86634f56cc5a0d41119212ce242dd5f (diff) | |
download | qemu-f5ec14808631699b99660728a00b5454ab4a545e.tar.gz qemu-f5ec14808631699b99660728a00b5454ab4a545e.tar.bz2 qemu-f5ec14808631699b99660728a00b5454ab4a545e.zip |
Fix size used for memset in alloc_output_file
The output->buf field is a pointer, not an array, so sizeof() is not
applicable. We must use the allocated string length instead.
Identified by gcc:
util/zbin.c: In function ‘alloc_output_file’:
util/zbin.c:146:37: warning: argument to ‘sizeof’ in ‘memset’ call
is the same expression as the destination; did you mean to
dereference it? [-Wsizeof-pointer-memaccess]
memset ( output->buf, 0xff, sizeof ( output->buf ) );
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | roms/ipxe/src/util/zbin.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/roms/ipxe/src/util/zbin.c b/roms/ipxe/src/util/zbin.c index 0dabaf1e3..3b7cf95b3 100644 --- a/roms/ipxe/src/util/zbin.c +++ b/roms/ipxe/src/util/zbin.c @@ -143,7 +143,7 @@ static int alloc_output_file ( size_t max_len, struct output_file *output ) { max_len ); return -1; } - memset ( output->buf, 0xff, sizeof ( output->buf ) ); + memset ( output->buf, 0xff, max_len ); return 0; } |