Skip to content

Commit

Permalink
sata_sil24: memset() overflow
Browse files Browse the repository at this point in the history
cb->atapi.cdb is an array of 16 u8 elements.  The call too memset()
would set the first part of the sge array to zero as well.  It's not
a packed struct.

This one has been around for five years.  I found it with Smatch.  I
think the reason no one has seen it before is because we normally call
sil24_fill_sg() and that overwrites sge with proper information?

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Dan Carpenter authored and Jeff Garzik committed Jun 10, 2010
1 parent 7908a9e commit 14e45c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ata/sata_sil24.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
} else {
prb = &cb->atapi.prb;
sge = cb->atapi.sge;
memset(cb->atapi.cdb, 0, 32);
memset(cb->atapi.cdb, 0, sizeof(cb->atapi.cdb));
memcpy(cb->atapi.cdb, qc->cdb, qc->dev->cdb_len);

if (ata_is_data(qc->tf.protocol)) {
Expand Down

0 comments on commit 14e45c1

Please sign in to comment.