aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt366.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-01-02 06:19:40 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:30 -0500
commit8bfa79fcb81d2bdb043f60ab4171704467808b55 (patch)
tree8b81b15237110ee30626057541e07b0ba8aa80bc /drivers/ata/pata_hpt366.c
parenta0cf733b333eeeafb7324e2897448006c693c26c (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_hpt366.c')
-rw-r--r--drivers/ata/pata_hpt366.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index 81deb2c3824c..2202c7ec16e3 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -151,23 +151,13 @@ static const char *bad_ata66_3[] = {
151 151
152static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[]) 152static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[])
153{ 153{
154 unsigned char model_num[ATA_ID_PROD_LEN]; 154 unsigned char model_num[ATA_ID_PROD_LEN + 1];
155 char *s;
156 unsigned int len;
157 int i = 0; 155 int i = 0;
158 156
159 ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); 157 ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
160 s = &model_num[0];
161 len = strnlen(s, sizeof(model_num));
162 158
163 /* ATAPI specifies that empty space is blank-filled; remove blanks */ 159 while (list[i] != NULL) {
164 while ((len > 0) && (s[len - 1] == ' ')) { 160 if (!strcmp(list[i], model_num)) {
165 len--;
166 s[len] = 0;
167 }
168
169 while(list[i] != NULL) {
170 if (!strncmp(list[i], s, len)) {
171 printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n", 161 printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n",
172 modestr, list[i]); 162 modestr, list[i]);
173 return 1; 163 return 1;