Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-serial@vger.kernel.org
Subject: [Suggestion] drivers/tty/serial: sprintf for filename[32].
Date: Sat, 01 Dec 2012 18:01:04 +0800	[thread overview]
Message-ID: <50B9D560.8090003@asianux.com> (raw)

Hello Alan Cox:

in drives/tty/serial/ucc_uart.c:
  at line 1231, the filename buffer length is 32.
  at line 1242, "fsl_qe_ucode_uart_%u_%u%u.bin" is 23 + 3*%u.
  at line 1237, after call soc_info. soc within 4 bytes, rev_h within 2 bytes, rev_l within 2 bytes.

my suggestion is:
  use "fsl_qe_ucode_uart_%.4u_%.2u%.2u.bin" instead of "fsl_qe_ucode_uart_%u_%u%u.bin";
  or use "char filename[64]" instead of "char filename[32]".
  please give your choice (or provide new choice).

  it is not a bug, it is only to make source code clearer or extensible.

  thanks.


1231                 } else {
1232                         char filename[32];
1233                         unsigned int soc;
1234                         unsigned int rev_h;
1235                         unsigned int rev_l;
1236 
1237                         soc = soc_info(&rev_h, &rev_l);
1238                         if (!soc) {
1239                                 dev_err(&ofdev->dev, "unknown CPU model\n");
1240                                 return -ENXIO;
1241                         }
1242                         sprintf(filename, "fsl_qe_ucode_uart_%u_%u%u.bin",
1243                                 soc, rev_h, rev_l);
1244 
1245                         dev_info(&ofdev->dev, "waiting for firmware %s\n",
1246                                 filename);
1247 



-- 
Chen Gang

Asianux Corporation

                 reply	other threads:[~2012-12-01 10:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=50B9D560.8090003@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-serial@vger.kernel.org \
    /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