Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5474686ybl; Tue, 27 Aug 2019 05:22:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYt86HmLR52Xg2fMhFFy0bWjMKF7o1hlXbDHNVY/tur9DB1SgQXAGVOAAISEhUw4e2c24N X-Received: by 2002:aa7:9112:: with SMTP id 18mr10660025pfh.127.1566908567900; Tue, 27 Aug 2019 05:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566908567; cv=none; d=google.com; s=arc-20160816; b=D4k3kr+jxKtwZQ/y1L6LHYzSXZgVl3E6+DayjS7dqsH7S563bmoLg+wxOzkQCFD4J9 y5YlbR/C21tQffrmFp7jNdReV0I+tGDRPFtlNDqC8S3sSLEwo7TTKDOjTosmvEb2ku2f rb9KuVcikID1+V7RPVcK2RBhUGqiGy+j//j+pA4ohmPz8f/qxHDfvz8F9LoEK3uN9aup /dlZCH93R4roeE3cHvTaVG+2nmscXVWO7KfGhDmy04ggrZYIQY451hFRm1NZLgAT8nxU FF9XXjXiFqxNsijTN4RdhFGrkhmrpt2Gm84U7o73qSVjy9brbk/JYd9gJZ+b7Mqg3W+d Hjpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9YiLMzN5FRFc66UBSg4I7hR0hdxNL+dhq+vTlwPS1+A=; b=ZsKU4/EF7Afor/g9SOebAKtUDTbdaeks7EcCRvJPk/7+o41c5GQgNL5UoWqs00+76Y ja2HZihvqjAv05mFV6xukwTkvxyy+qTxBtHD1UOTfJtykaGWGa7gXIhdjx0GUh6gVg3i g1fNAlF6woJIYndlXw6fJ9D8Gkj2z4s5ntiVvjdta7JjDn5wiAgALRKZgSs2nmx3zbD9 IlFfi42IIOXhgWNFevu+8YblAqwl6kQBO8P4VRWgyxIaphHwY0kNHEvUluQCRlF25k22 z1VgD7RTZMSLkjumKZarjGHNEV2x7fqyx8awHZY9PkuDx24AnJfxICNgWaZqjYmHVeSD mLSg== ARC-Authentication-Results: i=1; mx.google.com; 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 t20si11558295pgv.580.2019.08.27.05.22.30; Tue, 27 Aug 2019 05:22:47 -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; 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 S1729835AbfH0MUl (ORCPT + 99 others); Tue, 27 Aug 2019 08:20:41 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46287 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbfH0MUl (ORCPT ); Tue, 27 Aug 2019 08:20:41 -0400 Received: by mail-wr1-f66.google.com with SMTP id z1so18572083wru.13; Tue, 27 Aug 2019 05:20:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9YiLMzN5FRFc66UBSg4I7hR0hdxNL+dhq+vTlwPS1+A=; b=ZOGza1JY5t1oNUxdSuoZYqgcwlzDE4WglTtIViYZOobeMFj/KqDbFyFuO7VbUbIfCM UJTw0BJZHR5nRgO+47lx3YLoZLHq3qMRjG0R7+Ie5bazei2YxSvGx2nUO5lb5Xk28XWj uUKDQMaz6iqJ3lbUfb/FYOtBVny8mhaDIjuFGTTbDC4ghKdgwEq0Oi58rZmjIN0xo28X k6VAJlSd8fFd4Sg1oLkkAINg6xYnSVz5eszxWa3Aa/3mjO9TuK862A8yEKs9W0SX+TvV rt2lgxAo5ByZhienwXkSh56Vd0bjJ0YQWnSo9qzQEIYOaCGzypEEDffG4+m+UYBsjOPt mZyQ== X-Gm-Message-State: APjAAAVENYceb8ndoBIXsq8a411ADcR8pHLCxhSc/o3HyKGep3mr77Ei XcFQxPLZ/O0wSebSc53er4c= X-Received: by 2002:adf:e5d1:: with SMTP id a17mr4034066wrn.118.1566908439451; Tue, 27 Aug 2019 05:20:39 -0700 (PDT) Received: from green.intra.ispras.ru (bran.ispras.ru. [83.149.199.196]) by smtp.googlemail.com with ESMTPSA id f197sm8086254wme.22.2019.08.27.05.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2019 05:20:38 -0700 (PDT) From: Denis Efremov To: Masahiro Yamada , Michal Marek Cc: Denis Efremov , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] modpost: add NOFAIL to strndup Date: Tue, 27 Aug 2019 15:20:23 +0300 Message-Id: <20190827122023.15086-1-efremov@linux.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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