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]
Date:	Tue, 17 Mar 2015 19:43:16 +0530
From:	Arjun Sreedharan <arjun024@...il.com>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86,boot: standardize strcmp()

On 17 March 2015 at 13:16, Ingo Molnar <mingo@...nel.org> wrote:
>
> * Arjun Sreedharan <arjun024@...il.com> wrote:
>
>> strcmp() is always expected to return 0 when args are
>> same, <0 when arg1 is lesser and >0 otherwise.
>> Previously strcmp("a","b") returned 1. Now it gives -1.
>
> I'd also add the following to the changelog:
>
> Until now this bug never triggered, because all uses for strcmp() in
> the boot code tested for nonzero:

On a related note, IMO strcmp() should return {-1,0,1} since many
programmers just expect this behavior. just my opinion.

Arjun Sreedharan

>
>  triton:~/tip> git grep strcmp arch/x86/boot/
>  arch/x86/boot/boot.h:int strcmp(const char *str1, const char *str2);
>  arch/x86/boot/edd.c:            if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) {
>  arch/x86/boot/edd.c:            else if (!strcmp(eddarg, "off"))
>  arch/x86/boot/edd.c:            else if (!strcmp(eddarg, "on"))
>
> should in the future strcmp() be used in a comparative way in the boot
> code, it might have led to (not so subtle) bugs.
>
> Thanks,
>
>         Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ