mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Jason Uhlenkott <jasonuhl@sgi.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2.4] Fix rlimit check in precheck_file_write()
Date: Thu, 23 Dec 2004 11:29:33 +0000	[thread overview]
Message-ID: <1103801367.13188.5.camel@localhost.localdomain> (raw)
In-Reply-To: <20041222215759.GA217560@dragonfly.engr.sgi.com>

On Mer, 2004-12-22 at 21:57, Jason Uhlenkott wrote:
> Remove a broken assumption that rlimits are 32 bits which can cause
> nasty things to happen on 64-bit machines if we try to write past the
> 2^32-1th character of a file and a larger file size limit exists.
> 
> Signed-off-by: Jason Uhlenkott <jasonuhl@sgi.com>
> 
> --- linux-2.4.29-pre3.orig/mm/filemap.c	2004-11-17 03:54:22.000000000 -0800
> +++ linux-2.4.29-pre3/mm/filemap.c	2004-12-22 13:41:46.000000000 -0800
> @@ -3088,9 +3088,9 @@
>  			send_sig(SIGXFSZ, current, 0);
>  			goto out;
>  		}
> -		if (pos > 0xFFFFFFFFULL || *count > limit - (u32)pos) {
> +		if (*count > limit - pos) {
>  			/* send_sig(SIGXFSZ, current, 0); */
> -			*count = limit - (u32)pos;
> +			*count = limit - pos;
>  		}

Are you sure this is safe for all conceivable 32bit cases as well as
your 64bit one ? I don't think it is looking at the overflow cases in
the if that you removed checking of.

Alan


  reply	other threads:[~2004-12-23 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-22 21:57 Jason Uhlenkott
2004-12-23 11:29 ` Alan Cox [this message]
2004-12-23 16:28   ` Jason Uhlenkott

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=1103801367.13188.5.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=jasonuhl@sgi.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome