All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] ocfs2: question about dlmfs_file_read()
Date: Sun, 18 Apr 2010 19:32:13 -0000	[thread overview]
Message-ID: <20100418193201.GD7920@bicker> (raw)

Hello list,

I was looking through the code for something unrelated and I got
confused by this.

fs/ocfs2/dlmfs/dlmfs.c dlmfs_file_read()
   261          /* don't read past the lvb */
   262          if ((count + *ppos) > i_size_read(inode))
   263                  readlen = i_size_read(inode) - *ppos;
   264          else
   265                  readlen = count - *ppos;

	Shouldn't "readlen" just be "count" here?  What prevents it from 
	being a negative number?

   266
   267          lvb_buf = kmalloc(readlen, GFP_NOFS);

Anyway, this code has been around for a long time so I'm probably
missing something.  I was just curious.

regards,
dan carpenter

             reply	other threads:[~2010-04-18 19:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-18 19:32 Dan Carpenter [this message]
2010-04-23 20:50 ` [Ocfs2-devel] ocfs2: question about dlmfs_file_read() Joel Becker
2010-04-23 22:06   ` Sunil Mushran
2010-04-23 22:27     ` Joel Becker

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=20100418193201.GD7920@bicker \
    --to=error27@gmail.com \
    --cc=ocfs2-devel@oss.oracle.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 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.