From: Yujie Liu <yujie.liu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Edward Liaw <edliaw@google.com>, <oe-kbuild-all@lists.linux.dev>,
"Linux Memory Management List" <linux-mm@kvack.org>
Subject: Re: [linux-next:master 5507/6266] ../kselftest_harness.h:1167:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result'
Date: Wed, 17 Apr 2024 10:42:07 +0800 [thread overview]
Message-ID: <Zh82/+COncH0SO7l@yujie-X299> (raw)
In-Reply-To: <20240416114439.038054b9c33986a13f4757c7@linux-foundation.org>
On Tue, Apr 16, 2024 at 11:44:39AM -0700, Andrew Morton wrote:
> On Tue, 16 Apr 2024 14:35:18 +0800 kernel test robot <yujie.liu@intel.com> wrote:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head: 6bd343537461b57f3efe5dfc5fc193a232dfef1e
> > commit: c19377e23d4cb45f69c5d226ae3436f7fa818c8f [5507/6266] selftests/harness: remove use of LINE_MAX
> > compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161023.K0EsnDmF-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <yujie.liu@intel.com>
> > | Closes: https://lore.kernel.org/r/202404161023.K0EsnDmF-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > In file included from tls.c:24:
> > ../kselftest_harness.h: In function '__run_test':
> > >> ../kselftest_harness.h:1167:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result' [-Wunused-result]
> > 1167 | asprintf(&test_name, "%s%s%s.%s", f->name,
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 1168 | variant->name[0] ? "." : "", variant->name, t->name);
> > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Thanks. How does this look?
>
> --- a/tools/testing/selftests/kselftest_harness.h~selftests-harness-remove-use-of-line_max-fix-fix
> +++ a/tools/testing/selftests/kselftest_harness.h
> @@ -1163,8 +1163,12 @@ void __run_test(struct __fixture_metadat
> t->trigger = 0;
> memset(t->results->reason, 0, sizeof(t->results->reason));
>
> - asprintf(&test_name, "%s%s%s.%s", f->name,
> - variant->name[0] ? "." : "", variant->name, t->name);
> + if (asprintf(&test_name, "%s%s%s.%s", f->name,
> + variant->name[0] ? "." : "", variant->name, t->name) == -1) {
> + ksft_print_msg("ERROR ALLOCATING MEMORY\n");
> + t->exit_code = KSFT_FAIL;
> + _exit(t->exit_code);
> + }
>
> ksft_print_msg(" RUN %s ...\n", test_name);
>
> _
It fixes the warning for me. Thanks.
Tested-by: Yujie Liu <yujie.liu@intel.com>
prev parent reply other threads:[~2024-04-17 2:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 6:35 kernel test robot
2024-04-16 18:44 ` Andrew Morton
2024-04-16 19:02 ` Edward Liaw
2024-04-17 2:42 ` Yujie Liu [this message]
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=Zh82/+COncH0SO7l@yujie-X299 \
--to=yujie.liu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=edliaw@google.com \
--cc=linux-mm@kvack.org \
--cc=oe-kbuild-all@lists.linux.dev \
/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