summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-14 18:48:45 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-06-02 13:04:54 -0400
commit16c008bed057fbd352b1d624f335f97c1655ab4a (patch)
tree7b3f4bf9d266d18280f0958dc2593217c3c31b7a /src
parent146d55e60a4f6acd448f65c473daaf0380514fe0 (diff)
udev/ata_id: zero out variable properly
b8a2b0f76 'use initalization instead of explicit zeroing' introduced a bug where only the first sizeof(uint_t*) bytes would be zeroed out, instead of the whole array.
Diffstat (limited to 'src')
-rw-r--r--src/ata_id/ata_id.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ata_id/ata_id.c b/src/ata_id/ata_id.c
index 4d30fd8994..68a06b93b8 100644
--- a/src/ata_id/ata_id.c
+++ b/src/ata_id/ata_id.c
@@ -334,11 +334,10 @@ static int disk_identify(struct udev *udev,
int peripheral_device_type;
int all_nul_bytes;
int n;
- int is_packet_device;
+ int is_packet_device = 0;
/* init results */
- zero(out_identify);
- is_packet_device = 0;
+ memzero(out_identify, 512);
/* If we were to use ATA PASS_THROUGH (12) on an ATAPI device
* we could accidentally blank media. This is because MMC's BLANK
@@ -402,7 +401,7 @@ static int disk_identify(struct udev *udev,
out:
if (out_is_packet_device != NULL)
- *out_is_packet_device = is_packet_device;
+ *out_is_packet_device = is_packet_device;
return ret;
}