From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754000AbbCQONi (ORCPT ); Tue, 17 Mar 2015 10:13:38 -0400 Received: from mail-qc0-f175.google.com ([209.85.216.175]:34063 "EHLO mail-qc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752816AbbCQONh (ORCPT ); Tue, 17 Mar 2015 10:13:37 -0400 MIME-Version: 1.0 In-Reply-To: <20150317074608.GB27687@gmail.com> References: <1426520267-1803-1-git-send-email-arjun024@gmail.com> <20150317074608.GB27687@gmail.com> From: Arjun Sreedharan Date: Tue, 17 Mar 2015 19:43:16 +0530 Message-ID: Subject: Re: [PATCH] x86,boot: standardize strcmp() To: Ingo Molnar Cc: "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , x86@kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17 March 2015 at 13:16, Ingo Molnar wrote: > > * Arjun Sreedharan 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