From: shuah <shuah@kernel.org>
To: Geert Uytterhoeven <geert+renesas@glider.be>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Michal Marek <michal.lkml@markovi.net>
Cc: Jonathan Corbet <corbet@lwn.net>,
Bamvor Jian Zhang <bamv2005@gmail.com>,
Kees Cook <keescook@chromium.org>,
linux-kselftest@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, shuah <shuah@kernel.org>
Subject: Re: [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error
Date: Wed, 16 Jan 2019 15:03:41 -0700 [thread overview]
Message-ID: <7a3ce526-aefc-c2f1-9b11-215d609952b3@kernel.org> (raw)
In-Reply-To: <20190114135144.26096-2-geert+renesas@glider.be>
On 1/14/19 6:51 AM, Geert Uytterhoeven wrote:
> 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 <geert+renesas@glider.be>
> ---
> 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 f8d468f54e986dd0..aaa1e9f083c37215 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);
>
Thanks for the patch. Applied to linux-kselftest fixes for 5.0-rc4
thanks,
-- Shuah
next prev parent reply other threads:[~2019-01-16 22:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 13:51 [PATCH 00/12] selftests: Miscellaneous fixes Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error Geert Uytterhoeven
2019-01-16 22:03 ` shuah [this message]
2019-01-14 13:51 ` [PATCH 02/12] selftests: Fix output directory with O= Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 03/12] selftests: Fix header install " Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 04/12] selftests: android: ion: Fix ionmap_test dependencies Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules Geert Uytterhoeven
2019-01-14 23:16 ` Kees Cook
2019-01-14 13:51 ` [PATCH 06/12] selftests: lib.mk: Add rule to build object file from C source file Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 07/12] selftests: memfd: Fix build with O= Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 08/12] selftests: timestamping: Remove superfluous rules Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 09/12] selftests: sparc64: " Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 10/12] selftests: intel_pstate: Remove unused header dependency rule Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH 11/12] selftests: Add kselftest-build target Geert Uytterhoeven
2019-01-14 13:51 ` [PATCH/RFC 12/12] selftests: gpio: Fix building tools/gpio from kselftests Geert Uytterhoeven
2019-01-18 4:14 ` [PATCH 00/12] selftests: Miscellaneous fixes Masahiro Yamada
2019-01-18 7:57 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7a3ce526-aefc-c2f1-9b11-215d609952b3@kernel.org \
--to=shuah@kernel.org \
--cc=bamv2005@gmail.com \
--cc=corbet@lwn.net \
--cc=geert+renesas@glider.be \
--cc=keescook@chromium.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome