Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp207329imj; Thu, 14 Feb 2019 18:42:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IafvCe4wllzP5FZ6mQLSGKaQf6F7uj5Xe2OpNTNnqOL+qeskih3HPFbq7N0pkcYJsr7QSId X-Received: by 2002:a63:5861:: with SMTP id i33mr3114433pgm.60.1550198537527; Thu, 14 Feb 2019 18:42:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198537; cv=none; d=google.com; s=arc-20160816; b=p9d+EDOaB5x54KAI/0EChFF2ZOsQwGy5ewvbmasdVrwMWB1dG7X1ryN/tGWckk752l Ur9QJE/NV5mloBGGqzrjJpX8MKkNk0UgqGnkMo3wkaZc9zUhphNX0E+O23IlX9auTJmc 1gWs84kOTJz7gIiPxlkfECex6MD+eZapfBzAJvpIao14qpNsF/SkaRAO46lMOqhy+9u6 ADKzBLMJBYaL1XPKYq+6+6lSxbx24ZJREut4Uv1ENK7Ezg8oa30Cb6ecFvoi/by6kzHF ZzQ3mr/kn3MIe+zMvfCQjqpIGQjGRyYWjFv9fek577xt22h9UPPx+kZRl4BLEFAIM5T2 mYLA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I7zd6Yw2VZCIQ+ujH2uNMbpUagysUfgP++KEaoGEJvQ=; b=BC6/YZFzpjrC0INnc47p7y5mJON9KPeFzRB3NnwBp8CS4t30k5eli9Vr8VL+ZTe0AY pDSx74w4D7b+Ap82aWOvstH0akO2yuIVusDBMEp0t76W5+RIwwfHtxn3gSwU1ZojzN5g S6ePbUStmA2yiu6QGjgUQ9nllDB2IO4uhCUUYAOw7vaQ43mkoKectQ2JCM++NkF5w1hH OQS9T4XYsxHba56zFhTa2K83riyLsIgjVzoMDeyQ2P/UFDNmxBCKWnnO7tqssWSl+VrC nDKHUudFISZs5NWlMPHb8ZCSSy1u0oRyJd3Dvy2XhiaSTouCoY9sKZtSbg80e+407FOQ bRpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FYL8G2zG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j66si2218735pfb.182.2019.02.14.18.42.01; Thu, 14 Feb 2019 18:42:17 -0800 (PST) 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=@kernel.org header.s=default header.b=FYL8G2zG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730872AbfBOCk6 (ORCPT + 99 others); Thu, 14 Feb 2019 21:40:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:49952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388878AbfBOCJr (ORCPT ); Thu, 14 Feb 2019 21:09:47 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D96A621B68; Fri, 15 Feb 2019 02:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196586; bh=PPcq0NoDP+MltGyd+PyfI2fMVaVNCxi/PSdZHVyrOYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYL8G2zGy9+C+6AERnDWsm/8Hham9Mv9Shk3s6zLV0rzYwZFv+XetYCdQEEKI9CH2 ZcoIBpjIz32v0M3XjRQARqNysIj/j/7iNzAmHfD1aPeHuo45EB6RmeySmDuf7eCt+f 0doVOHTHRke08jMl42FBhx4HKMmV/imRBkY5xKGM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Geert Uytterhoeven , Shuah Khan , Sasha Levin , linux-gpio@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 30/77] selftests: gpio-mockup-chardev: Check asprintf() for error Date: Thu, 14 Feb 2019 21:08:08 -0500 Message-Id: <20190215020855.176727-30-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 508cacd7da6659ae7b7bdd0a335f675422277758 ] With gcc 7.3.0: gpio-mockup-chardev.c: In function ‘get_debugfs’: gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result] asprintf(path, "%s/gpio", mnt_fs_get_target(fs)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Handle asprintf() failures to fix this. Signed-off-by: Geert Uytterhoeven Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c index f8d468f54e98..aaa1e9f083c3 100644 --- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c +++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c @@ -37,7 +37,7 @@ static int get_debugfs(char **path) struct libmnt_table *tb; struct libmnt_iter *itr = NULL; struct libmnt_fs *fs; - int found = 0; + int found = 0, ret; cxt = mnt_new_context(); if (!cxt) @@ -58,8 +58,11 @@ static int get_debugfs(char **path) break; } } - if (found) - asprintf(path, "%s/gpio", mnt_fs_get_target(fs)); + if (found) { + ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs)); + if (ret < 0) + err(EXIT_FAILURE, "failed to format string"); + } mnt_free_iter(itr); mnt_free_context(cxt); -- 2.19.1