mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abramo Bagnara <abramo.bagnara@libero.it>
To: Michal Jaegermann <michal@harddata.com>
Cc: linux-kernel@vger.kernel.org, akenning@dog.topology.org
Subject: Re: easy-to-fix bug in /dev/null driver
Date: Tue, 21 Nov 2000 00:13:14 +0100	[thread overview]
Message-ID: <3A19B00A.C9D98839@libero.it> (raw)
In-Reply-To: <20001120160638.A14325@dog.topology.org> <20001121005304.A15760@dog.topology.org> <20001120123300.A19251@mail.harddata.com>

Michal Jaegermann wrote:
> 
> On Tue, Nov 21, 2000 at 12:53:04AM +1030, Alan Kennington wrote:
> >
> > I still think that write_null() should be rewritten as:
> >
> > ===================================================
> > static ssize_t write_null(struct file * file, const char * buf,
> >                           size_t count, loff_t *ppos)
> > {
> >         return (count <= 2147483647) ? count : 2147483647;
> > }
> > ===================================================
> >
> > This would fix the problem without introducing any new errors.
> > (Unless someone change the definitions of ssize_t and size_t!!)
> 
> Someone already did.  Or, more precisely, there are platforms where
> values used in 'return' above are bogus.
> 
> Shifting 1 up by sizeof(ssize_t) * 8 - 1 and subtracting one from
> the result, in order to derive the maximal allowable value, might work.
> I do not think that we have anything with non-8 bit bytes yet.
> 

I think it's time to provide SIZE_MAX and SSIZE_MAX along with
size_t/ssize_t typedefs.

-- 
Abramo Bagnara                       mailto:abramo@alsa-project.org

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy

ALSA project is            http://www.alsa-project.org
sponsored by SuSE Linux    http://www.suse.com

It sounds good!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

      reply	other threads:[~2000-11-20 23:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-20  5:36 Alan Kennington
2000-11-20 14:23 ` Alan Kennington
2000-11-20 19:33   ` Michal Jaegermann
2000-11-20 23:13     ` Abramo Bagnara [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=3A19B00A.C9D98839@libero.it \
    --to=abramo.bagnara@libero.it \
    --cc=akenning@dog.topology.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal@harddata.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

all inboxes | Powered by JetHome®