linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-parisc@vger.kernel.org
Subject: Re: pointless code in probe_kernel_read
Date: Mon, 11 Nov 2013 22:33:45 +0100	[thread overview]
Message-ID: <52814D39.8060305@gmx.de> (raw)
In-Reply-To: <alpine.LRH.2.02.1311111009060.377@file01.intranet.prod.int.rdu2.redhat.com>

Hi Mikulas,

On 11/11/2013 04:13 PM, Mikulas Patocka wrote:
> Hi Helge
> 
> I noted that you created this function in commit 
> db080f9c530f78dad661257885a1893506077068
> 
> long probe_kernel_read(void *dst, const void *src, size_t size)
> {
>         unsigned long addr = (unsigned long)src;
> 
>         if (size < 0 || addr < PAGE_SIZE)
>                 return -EFAULT;
> 
>         /* check for I/O space F_EXTEND(0xfff00000) access as well? */
> 
>         return __probe_kernel_read(dst, src, size);
> }
> 
> size_t is unsigned, so comparison size < 0 doesn't make sense. What 
> exactly did you mean by this test?

Of course you are right. The "size < 0" check is superfluous.
I noticed that too when the code went upstream, but I was not yet motivated
too much to remove it again - at least the compiler should optimize it out.

The second part (addr < PAGE_SIZE) is relevant though.

Helge

      reply	other threads:[~2013-11-11 21:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 15:13 pointless code in probe_kernel_read Mikulas Patocka
2013-11-11 21:33 ` Helge Deller [this message]

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=52814D39.8060305@gmx.de \
    --to=deller@gmx.de \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mpatocka@redhat.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 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).