kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: bjorn@mork.no (Bjørn Mork)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Possible error in debugfs/file.c
Date: Tue, 02 Dec 2014 17:30:28 +0100	[thread overview]
Message-ID: <878uiqovyz.fsf@nemi.mork.no> (raw)
In-Reply-To: <20141202161328.GA15584@arch> (land's message of "Wed, 3 Dec 2014 03:13:28 +1100")

land.ho87 at gmail.com writes:

> 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 };

No, it doesn't.  file->private_data points to a string buffer allocated
in u32_array_open() and filled with a string representation of the
struct array_data, using u32_format_array().

So calling strlen() on it is perfectly valid and reasonable.




Bj?rn

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 16:13 Possible error in debugfs/file.c land.ho87 at gmail.com
2014-12-02 16:30 ` Bjørn Mork [this message]
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=878uiqovyz.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --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 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).