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

H. Peter Anvin (hpa@transmeta.com)
29 Apr 1997 22:33:00 GMT


Followup to: <2nbu6xlix5.fsf@cclan.fuw.edu.pl>
By author: Michal Jankowski <michalj@fuw.edu.pl>
In newsgroup: linux.dev.kernel
>
> 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-)
>

Is "model" null-terminated? If so, that should be:

strcmp(p->name, model)

Otherwise, you need to have the length of the "model" through some
other means, and should do:

if ( strlen(p->name) == model_len && strncmp(...

-hpa

-- 
Always looking for a few good BOsFH.  **  Linux - the OS of global cooperation
        I am Baha'i -- ask me about it or see http://www.bahai.org/