From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1B0BC76186 for ; Tue, 30 Jul 2019 02:51:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3D7C20679 for ; Tue, 30 Jul 2019 02:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731515AbfG3CvK (ORCPT ); Mon, 29 Jul 2019 22:51:10 -0400 Received: from smtprelay0163.hostedemail.com ([216.40.44.163]:39923 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731382AbfG3CvK (ORCPT ); Mon, 29 Jul 2019 22:51:10 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id A9B4F18224D78; Tue, 30 Jul 2019 02:51:08 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: title66_9d2ae4e3cb1b X-Filterd-Recvd-Size: 1909 Received: from XPS-9350 (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Tue, 30 Jul 2019 02:51:07 +0000 (UTC) Message-ID: <3ec468adbd632c2e435c618a1027c4e6c8f97e38.camel@perches.com> Subject: Re: [PATCH] alpha: Replace strncmp with str_has_prefix From: Joe Perches To: Chuhong Yuan Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 29 Jul 2019 19:51:05 -0700 In-Reply-To: <20190730024401.17152-1-hslester96@gmail.com> References: <20190730024401.17152-1-hslester96@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.5-0ubuntu0.18.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-07-30 at 10:44 +0800, Chuhong Yuan wrote: > In commit b6b2735514bc > ("tracing: Use str_has_prefix() instead of using fixed sizes") > the newly introduced str_has_prefix() was used > to replace error-prone strncmp(str, const, len). > Here fix codes with the same pattern. > > Signed-off-by: Chuhong Yuan > --- > arch/alpha/boot/tools/objstrip.c | 3 ++- > arch/alpha/kernel/setup.c | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/alpha/boot/tools/objstrip.c b/arch/alpha/boot/tools/objstrip.c [] > @@ -148,7 +148,8 @@ main (int argc, char *argv[]) > #ifdef __ELF__ > elf = (struct elfhdr *) buf; > > - if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) { > + if (elf->e_ident[0] == 0x7f && > + str_has_prefix((char *)elf->e_ident + 1, "ELF")) { While the original indentation didn't use tabs, please do not make it worse by misaligning.