Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5750643ybl; Tue, 27 Aug 2019 09:08:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMyok8hmqlutsl9ZWAaLM7ahVtGsPUFgqr9UXQtmhEyakwhnolSsyRmTZ86jAW27z2qRAw X-Received: by 2002:a63:904:: with SMTP id 4mr3744718pgj.397.1566922131241; Tue, 27 Aug 2019 09:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566922131; cv=none; d=google.com; s=arc-20160816; b=iC4Dr7a95wHHh0YJMvI2hZYypKxzejg3jInLdAG6Hx+d4k50yNAoLKOUlSz2GsBrOG W8GC2sOg6VEONKCzJesRHm+S0q2emqClA6uBMLIbQoY+LNQOnWEoPsXXn7arSRTaMAho w4ym47b8ytLrZFQ0vMYDZq2qPbbrpvVfhAEnSkcHyxaBEWGox/RJ5pZgLs+A3VlDB/nV eCUJGdJZe4srfGMnuhE9Jq0Ddl1eF2iusWyW7D6M4jInbfG+PirsokteazofFUt0qY4D OrIUp0U6u12m9952sOMtOjinejFXEIQDL5QMKBfSNG9OGC2iLrTgZ728OEsRKs22HlLu IL2A== 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=fJQ3YPvF66148dHwd0LxCwhaCfiEwfreqcK+Q38PugE=; b=cE+6Ymv7fgb51NDVp3u4oGbpyjml3mRUwa8imo9wVaKQMoGV1jteFm38DxCf69fegx KdN+komho0enZ209nSXRSvzDlknmAZ73BSZJg3CrRFpdmj7dCABDsW14nfiXDxI7aLL+ cOft3GSZZTHtGjIQAwmuaFlAWEzGEoFCXuSgMV9P+BfS2oVt2wtzLsh2eVjCBOu7irQt 51N8Vx5dahkh47iYfC/vja7iktte0xaoM4wMJUFQ+G9YHJ8TPivwXooZTW/Pi/Mf4y1u 5sLP/C3cW1AyG4BoGmqn/K3t1iBMdB+n6YBx5fCs12KCts/8MxsuHa4x2EzjLrKACWcT 08JQ== 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 f26si12319535pga.117.2019.08.27.09.08.35; Tue, 27 Aug 2019 09:08:51 -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 S1729578AbfH0QG3 (ORCPT + 99 others); Tue, 27 Aug 2019 12:06:29 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34063 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728711AbfH0QG3 (ORCPT ); Tue, 27 Aug 2019 12:06:29 -0400 Received: by mail-wm1-f66.google.com with SMTP id e8so2749485wme.1 for ; Tue, 27 Aug 2019 09:06:27 -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=fJQ3YPvF66148dHwd0LxCwhaCfiEwfreqcK+Q38PugE=; b=OTUjPJRpudIIqoWhpWAuhwv7DHRyDMuKN9ckovHh3XwPlj70mrGhgOnRW/lTRbJBlN V4asRmPcPoY43wajCmKURPDOGYlZaWgkpPfH7Ini7SSmcdKzCq9P5+MvL/XWY9TaQD4J gcfXDFkg6NcB7+W1YctlpULTFnqPmDPExW6Nj41pAek/7H+4F6NJzDD2ERb0OXpgOmfg FTkx1dV7kxLG5XrTCYitHnS6K81SrLGe783mljvCQ/6nKmQAyxs5Rff0o15klBcV/HSZ fKybSWghJk3hbpjlkmVHbLDlcP5YejIXL6KBEZ2tCiNQuOnZVxGMY7wEINLmVYyGpKUr V8+A== X-Gm-Message-State: APjAAAWgbAVWFmqA7huIonuTq16czEcCW/SWhO7LDbUJkux0JmA6GMrA PWptMG7l55cGTVzRTIgNzk2Oyc6z X-Received: by 2002:a1c:7513:: with SMTP id o19mr28751013wmc.126.1566921987104; Tue, 27 Aug 2019 09:06:27 -0700 (PDT) Received: from green.intra.ispras.ru (bran.ispras.ru. [83.149.199.196]) by smtp.googlemail.com with ESMTPSA id t14sm14146684wrs.58.2019.08.27.09.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2019 09:06:26 -0700 (PDT) From: Denis Efremov To: linux-kernel@vger.kernel.org Cc: Denis Efremov , Greg Kroah-Hartman , Leonardo Bras , Allison Randal , Masahiro Yamada , Thomas Gleixner Subject: [PATCH] ASN.1: Fix NULL check after strdup call Date: Tue, 27 Aug 2019 19:06:12 +0300 Message-Id: <20190827160612.11114-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 strdup function returns a pointer to the newly allocated string, or a NULL if an error occurred. Thus, grammar_name should be checked right after strdup call. p variable can't be NULL in this context. This follows from p check before the strdup call. Signed-off-by: Denis Efremov --- scripts/asn1_compiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c index adabd4145264..985fb81cae79 100644 --- a/scripts/asn1_compiler.c +++ b/scripts/asn1_compiler.c @@ -625,7 +625,7 @@ int main(int argc, char **argv) p = strrchr(argv[1], '/'); p = p ? p + 1 : argv[1]; grammar_name = strdup(p); - if (!p) { + if (!grammar_name) { perror(NULL); exit(1); } -- 2.21.0