Re: [linux-next:master 5507/6266] ../kselftest_harness.h:1167:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 16, 2024 at 11:44 AM Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> 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);
>
> _
>

Thanks for fixing this, that looks good to me.

Reviewed-by: Edward Liaw <edliaw@xxxxxxxxxx>





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux