mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: liplianin@me.by
Cc: linux-kernel@vger.kernel.org
Subject: re: [media] Altera FPGA firmware download module
Date: Thu, 14 Jun 2012 21:31:13 +0300	[thread overview]
Message-ID: <20120614183113.GB6383@elgon.mountain> (raw)

Hello Igor M. Liplianin,

The patch fa766c9be58b: "[media] Altera FPGA firmware download 
module" from Jan 25, 2011, leads to the following warning:
drivers/misc/altera-stapl/altera.c:2204 altera_get_note()
	 error: strlcpy() 'key' too small (33 vs 256)

drivers/misc/altera-stapl/altera.c
  2200                  if ((i >= 0) && (i < note_count)) {
  2201                          status = 0;
  2202  
  2203                          if (key != NULL)
  2204                                  strlcpy(key, &p[note_strings +
  2205                                                  get_unaligned_be32(
  2206                                                  &p[note_table + (8 * i)])],
  2207                                          length);
  2208  
  2209                          if (value != NULL)
  2210                                  strlcpy(value, &p[note_strings +
  2211                                                  get_unaligned_be32(
  2212                                                  &p[note_table + (8 * i) + 4])],
  2213                                          length);
  2214  
  2215                          *offset = i + 1;

The problem is that strlcpy() is using 256 as the size of "key" but
actually it is the size of "value".  Except that "value" is 257 bytes so
it is an off by one of the size of "value".

It probably doesn't cause a problem, but it upsets the static checkers
and it's pretty ugly.

regards,
dan carpenter


                 reply	other threads:[~2012-06-14 18:31 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=20120614183113.GB6383@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liplianin@me.by \
    /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

all inboxes | Powered by JetHome®