From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: netdev <netdev@vger.kernel.org>,
Bhumika Goyal <bhumirks@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
David Windsor <dwindsor@gmail.com>,
Elena Reshetova <elena.reshetova@intel.com>,
Hans Liljestrand <ishkamiel@gmail.com>,
Johannes Berg <johannes.berg@intel.com>,
Kees Cook <keescook@chromium.org>,
Roopa Prabhu <roopa@cumulusnetworks.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] atm/clip: Use seq_puts() in svc_addr()
Date: Mon, 8 Jan 2018 00:58:05 +0200 [thread overview]
Message-ID: <CAHp75Vf-fNi-ATKd-EpkO3HDP2TZCWFc6EEU5a5r-zkZTcHQYg@mail.gmail.com> (raw)
In-Reply-To: <97636808-1d9f-d196-ebce-fbd2505c50e2@users.sourceforge.net>
On Sat, Jan 6, 2018 at 11:44 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 6 Jan 2018 22:34:12 +0100
>
> Two strings should be quickly put into a sequence by two function calls.
> Thus use the function "seq_puts" instead of "seq_printf".
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> net/atm/clip.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/atm/clip.c b/net/atm/clip.c
> index d4f6029d5109..62a852165b19 100644
> --- a/net/atm/clip.c
> +++ b/net/atm/clip.c
> @@ -708,11 +708,11 @@ static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr)
> static int e164[] = { 1, 8, 4, 6, 1, 0 };
>
> if (*addr->sas_addr.pub) {
> - seq_printf(seq, "%s", addr->sas_addr.pub);
> + seq_puts(seq, addr->sas_addr.pub);
Which opens a lot of security concerns.
Never do this again.
> if (*addr->sas_addr.prv)
> seq_putc(seq, '+');
> } else if (!*addr->sas_addr.prv) {
> - seq_printf(seq, "%s", "(none)");
> + seq_puts(seq, "(none)");
...while this one is okay per se, better to keep above pattern (same
style over the piece of code / function).
> return;
> }
> if (*addr->sas_addr.prv) {
> --
> 2.15.1
>
P.S. I'm wondering what would be first, Markus starts looking into the
actual code, or most (all) of the maintainers just ban him.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2018-01-07 22:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-06 21:44 [PATCH] atm/clip: Use seq_puts() in svc_addr() SF Markus Elfring
2018-01-06 22:25 ` Stefano Brivio
2018-01-07 8:19 ` SF Markus Elfring
2018-01-07 15:30 ` Stefano Brivio
2018-01-07 16:30 ` SF Markus Elfring
2018-01-07 22:58 ` Andy Shevchenko [this message]
2018-01-08 7:25 ` [PATCH] " SF Markus Elfring
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=CAHp75Vf-fNi-ATKd-EpkO3HDP2TZCWFc6EEU5a5r-zkZTcHQYg@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=bhumirks@gmail.com \
--cc=davem@davemloft.net \
--cc=dwindsor@gmail.com \
--cc=elena.reshetova@intel.com \
--cc=elfring@users.sourceforge.net \
--cc=ishkamiel@gmail.com \
--cc=johannes.berg@intel.com \
--cc=keescook@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.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;
as well as URLs for NNTP newsgroup(s).