Re: 'black list' in drivers/block/ide_modes.h is broken

Derrik Pates (
Tue, 29 Apr 1997 16:48:27 -0500 (CDT)

Could we not use a chunk of code like

int i, j;
i = strlen(p->name);
j = strlen(model);
if (strncmp(p->name, model, ( (i > j) ? i : j ));

to take the longer length and compare over that? That chunk of code is, of
course, nowhere near well-optimized enough. But, I think the general idea
is sound. Maybe not, though. Let me know what you think.

Derrik Pates

On 29 Apr 1997, Michal Jankowski wrote:

> Due to the way a disk name is compared to the 'black list', some
> perfectly good new hard drives are mistakenly recognized as old,
> broken, blacklisted ones.
> For example, "WDC 21200H" will match a (blacklisted) "WDC 2120",
> because only as many characters as are present in a blacklisted name
> are checked.
> The offending line of code is:
> if (strncmp(p->name, model, strlen(p->name)) == 0)
> No, I don't know what the proper fix might be 8-)