lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <4810E315.8080303@sun.com>
Date:	Thu, 24 Apr 2008 12:44:21 -0700
From:	Matheos Worku <Matheos.Worku@....COM>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] [NIU] Determine the # of ports from the card's VPD
 data.

David Miller wrote:
> From: Matheos Worku <matheos.worku@....com>
> Date: Wed, 23 Apr 2008 10:10:52 -0700
>
>   
>> +#define NIU_BMD_MATCHES(np, md_str) \
>> +  (!strncmp(np->vpd.board_model, md_str, strlen(md_str)))
>>     
>
> Why is this special construct necessary?  How can anyone tell the
> reason this is needed by reading this code?
>
> Plain ole' strcmp() should suffice.  If the string length is
> different, we should get a comparison failure.  We've also made sure
> that the board_model[] field is a properly null terminated string.
>
> Is the issue that there could be some spurious trailing characters in
> the board_model[] string that we'd like to ignore?
>
> If that's the case this comparison deserves it's own small function,
> with some descriptive text, rather than an ugly and undescriptive
> macro.
>   
Dave,
Thanks a lot for the feedback.
The board model contains a HW dash version number which changes with HW 
change. Need to ignore  the - version number.
A new patch, using a small function as you suggested is attached.

Matheos

> Something like:
>
> /* Board model strings can have trailing characters we wish
>  * to ignore during comparison, for example:
>  *
>  *	XXXX (add example(s) here) XXX
>  */
> static int niu_board_model_compare(struct niu *np, const char *model)
> {
> 	return strncmp(np->vpd.board_model, model, strlen(model));
> }
>
> Thanks.
>   


View attachment "ncr.patch" of type "text/x-patch" (4059 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ