diff options
author | Tejun Heo <htejun@gmail.com> | 2007-01-02 06:19:40 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:30 -0500 |
commit | 8bfa79fcb81d2bdb043f60ab4171704467808b55 (patch) | |
tree | 8b81b15237110ee30626057541e07b0ba8aa80bc /drivers/ata/pata_it821x.c | |
parent | a0cf733b333eeeafb7324e2897448006c693c26c (diff) |
libata: use ata_id_c_string()
There were several places where ATA ID strings are manually terminated
and in some places possibly unterminated strings were passed to string
functions which don't limit length like strstr(). This patch converts
all of them over to ata_id_c_string().
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_it821x.c')
-rw-r--r-- | drivers/ata/pata_it821x.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index c84dfaede89c..171fbd206bd5 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -531,22 +531,9 @@ static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused | |||
531 | 531 | ||
532 | static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) | 532 | static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) |
533 | { | 533 | { |
534 | unsigned char model_num[ATA_ID_PROD_LEN]; | 534 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; |
535 | char *s; | ||
536 | unsigned int len; | ||
537 | 535 | ||
538 | /* This block ought to be a library routine as it is in several | 536 | ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num)); |
539 | drivers now */ | ||
540 | |||
541 | ata_id_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num)); | ||
542 | s = &model_num[0]; | ||
543 | len = strnlen(s, sizeof(model_num)); | ||
544 | |||
545 | /* ATAPI specifies that empty space is blank-filled; remove blanks */ | ||
546 | while ((len > 0) && (s[len - 1] == ' ')) { | ||
547 | len--; | ||
548 | s[len] = 0; | ||
549 | } | ||
550 | 537 | ||
551 | if (adev->max_sectors > 255) | 538 | if (adev->max_sectors > 255) |
552 | adev->max_sectors = 255; | 539 | adev->max_sectors = 255; |