2022-05-23 07:13:09

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH v7 15/25] scripts: checkpatch: diagnose uses of `%pA` in the C side

On Mon, 2022-05-23 at 04:01 +0200, Miguel Ojeda wrote:
> The `%pA` format specifier is only intended to be used from Rust.
>
> `checkpatch.pl` already gives a warning for invalid specificers:
>
> WARNING: Invalid vsprintf pointer extension '%pA'
>
> With this change, we introduce an error message with further
> explanation:
>
> ERROR: '%pA' is only intended to be used from Rust code
>
> Suggested-by: Kees Cook <[email protected]>
> Co-developed-by: Alex Gaynor <[email protected]>
> Signed-off-by: Alex Gaynor <[email protected]>
> Co-developed-by: Wedson Almeida Filho <[email protected]>
> Signed-off-by: Wedson Almeida Filho <[email protected]>
> Signed-off-by: Miguel Ojeda <[email protected]>

How many developers are required for a trivial patch?

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -6784,6 +6784,10 @@ sub process {
> my $stat_real = get_stat_real($linenr, $lc);
> my $ext_type = "Invalid";
> my $use = "";
> + if ($bad_specifier =~ /pA/) {
> + ERROR("VSPRINTF_RUST",
> + "'\%pA' is only intended to be used from Rust code\n" . "$here\n$stat_real\n");
> + }
> if ($bad_specifier =~ /p[Ff]/) {

and this should now use elsif

> $use = " - use %pS instead";
> $use =~ s/pS/ps/ if ($bad_specifier =~ /pf/);




2022-05-25 13:33:46

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH v7 15/25] scripts: checkpatch: diagnose uses of `%pA` in the C side

On Mon, May 23, 2022 at 4:17 AM Joe Perches <[email protected]> wrote:
>
> How many developers are required for a trivial patch?

We are sending the core series as a team, so by default I acknowledge
all the maintainers. But yeah, I could drop some of the
Co-developed-by's.

> and this should now use elsif

Yeah, will change.

By the way, I also thought about skipping the warning if the error is
there, e.g. wrapping everything else in an `else`, if you prefer.

Thanks for the very quick review!

Cheers,
Miguel