Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1051326ybl; Wed, 28 Aug 2019 08:58:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNxypntfbE8CG6upNGOU9hu83nw5ihFOks8bbocLlRLuW9UkfjxyCHTflwoVyA/qN+/9ac X-Received: by 2002:a17:902:8488:: with SMTP id c8mr4760263plo.164.1567007939375; Wed, 28 Aug 2019 08:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567007939; cv=none; d=google.com; s=arc-20160816; b=Rdmejo6lwHq0uuSm4qI36optTNJ5/9ek1eRoQ4OSDjyPmf4wdojeRCUQ6HcfL4/seI FMDRI4TGY0/adfDG6sGo++yEL6/1BHgDz93kDfT7slVCNQiQJo6kye/bw1x6RljIrFSO PoUA1wNt1t5rMKDDCUTKE3l7TY742s98Rvcb0jdiNyu4915WCZ4P+2oNm2UCbhR43VlB lei79fjZbpK8jG2rQ19HYm3WT00ihayjDo69npU1vJR9jt5ahGU2HSFQlLXr2Dn+d7T/ ShryUmX6SWIfioZB2tEL2nXfLHhxIV+b4TXrP5bThy5huoxspn/uVarfU4rzPeDzOjTe 2Ffg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=WOq24sipo81zCaadKOitrcTEmGWmhSf63Aseozcvth4=; b=GCLdos5omVyyedl0eSbnDCyB7XNdMXZrJSt0zOc2SzkR2zEa26Mep2LUO//+n5G3GR ia1J6Ig7ECX3PeXOmm9oJW6jsv9ZIDlHD8gAsyZIgVk+CwYSZd64qkl7JA7p59obcWwi WDEjCoPotZykPBYFWPKo30wab69aEl9yYxV+l3ngFXyqBdO+XgNaNDfb+o97T4Sjcqbs dYfJgx6+PB5AlUD1NO4SWPXE7RaXmYmPc13qca+eOk1meeQLU1uEJgW6OgsGMVXk/6Sl 8PEbuYzLWcdxKHPa4e5hHP6RmLI6PsdPQlgZhw/xaESTy+zsTz/6EFUhpmGr3PFNXt+J eMmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="s/mlgRFC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si2188877plv.189.2019.08.28.08.58.42; Wed, 28 Aug 2019 08:58:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="s/mlgRFC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbfH1P5H (ORCPT + 99 others); Wed, 28 Aug 2019 11:57:07 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:26895 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726400AbfH1P5H (ORCPT ); Wed, 28 Aug 2019 11:57:07 -0400 Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (authenticated) by conssluserg-06.nifty.com with ESMTP id x7SFujdT012309; Thu, 29 Aug 2019 00:56:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com x7SFujdT012309 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1567007806; bh=WOq24sipo81zCaadKOitrcTEmGWmhSf63Aseozcvth4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=s/mlgRFC8JlsS8RKx3q5gkPZ/FgEQlIglWZ4C7FhPI61Tj14OfoMCV52TNuKgtLWD +dmB5dnaNueaTeD8jQNlSAA9QqNNaz4tRwibip3yERyacGjoKUF4KO6abpn/FYaWyn kVOG+MmBjbD7YQBm8WQVZFqm/+C8EfIqIo1OpfUU3aI4edfqrdubrJyDnh1MeR9Zao 8dimoJHA3G4c5+8GMI5fIXcpGPNSPybOxeiL6+2KrlsFBa+jQDd/pfOwR2kw5lmWka dUS2Zpdi33q+Tr1aeNv32xfXAtwGFCmW6kxKmHuUUMWR8GK7pUQJjQjWpawPQhPOY4 sxPlkKRTRjl6g== X-Nifty-SrcIP: [209.85.222.51] Received: by mail-ua1-f51.google.com with SMTP id m8so150445uap.2; Wed, 28 Aug 2019 08:56:45 -0700 (PDT) X-Gm-Message-State: APjAAAXsI4USpKHh1gUVMpqDKyKhr+I4Oi/JwILDDE5ceGzDx0bk42KL r43kc8CfXRpUhYSmdJLCf+/sjx3V8HBvlUdMpUA= X-Received: by 2002:a9f:31cb:: with SMTP id w11mr2358004uad.40.1567007804525; Wed, 28 Aug 2019 08:56:44 -0700 (PDT) MIME-Version: 1.0 References: <20190827122023.15086-1-efremov@linux.com> In-Reply-To: <20190827122023.15086-1-efremov@linux.com> From: Masahiro Yamada Date: Thu, 29 Aug 2019 00:56:08 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] modpost: add NOFAIL to strndup To: Denis Efremov Cc: Michal Marek , Linux Kbuild mailing list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 9:20 PM Denis Efremov wrote: > > Add NOFAIL check for the strndup call, because the function > allocates memory and can return NULL. All calls to strdup in > modpost are checked with NOFAIL. > > Signed-off-by: Denis Efremov > --- Applied to linux-kbuild. Thanks. > scripts/mod/modpost.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index f277e116e0eb..0255538528fe 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -795,9 +795,9 @@ static int match(const char *sym, const char * const pat[]) > > /* "*foo*" */ > if (*p == '*' && *endp == '*') { > - char *here, *bare = strndup(p + 1, strlen(p) - 2); > + char *bare = NOFAIL(strndup(p + 1, strlen(p) - 2)); > + char *here = strstr(sym, bare); > > - here = strstr(sym, bare); > free(bare); > if (here != NULL) > return 1; > -- > 2.21.0 > -- Best Regards Masahiro Yamada