All of lore.kernel.org
 help / color / mirror / Atom feed
From: land.ho87@gmail.com (land.ho87 at gmail.com)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Possible error in debugfs/file.c
Date: Wed, 3 Dec 2014 03:13:28 +1100	[thread overview]
Message-ID: <20141202161328.GA15584@arch> (raw)

I'm just reading the kernel source and came across this which doesn't look quite right to me:
616         size_t size = strlen(file->private_data);

strlen is used here when the pointer points to type:
567 struct array_data {
568         void *array;
569         u32 elements;
570 };

I think line 616 should probably be something like:
size_t size = file->private_data.elements*sizeof(u32);

I think strlen would terminate incorrectly on any null byte, and is unnecessary
since the data is already counted.

Is this a legitimate criticism?

             reply	other threads:[~2014-12-02 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 16:13 land.ho87 at gmail.com [this message]
2014-12-02 16:30 ` Possible error in debugfs/file.c Bjørn Mork
2014-12-02 16:45 ` Sudip Mukherjee

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=20141202161328.GA15584@arch \
    --to=land.ho87@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.