From: Tejun Heo Date: Mon, 5 Nov 2007 20:42:25 +0000 (+0100) Subject: ide: do_identify() string termination fix X-Git-Tag: v2.6.24-rc2~29^2~10 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=699b052ad2996c4ca87aa4b9d4a51dcca0f9e588;p=linux-2.6 ide: do_identify() string termination fix Terminates id->model string before invoking strstr() in do_identify(). Signed-off-by: Tejun Heo Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 6a6f2e066b..56fb0b8434 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -172,11 +172,12 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); + /* we depend on this a lot! */ + id->model[sizeof(id->model)-1] = '\0'; + if (strstr(id->model, "E X A B Y T E N E S T")) goto err_misc; - /* we depend on this a lot! */ - id->model[sizeof(id->model)-1] = '\0'; printk("%s: %s, ", drive->name, id->model); drive->present = 1; drive->dead = 0;