public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: Roel Kluin <12o3l@tiscali.nl>
Cc: hjlipp@web.de, gigaset307x-common@lists.sourceforge.net,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gigaset: gigaset_isowbuf_getbytes() may return signed unnoticed
Date: Fri, 25 Apr 2008 11:29:08 +0200	[thread overview]
Message-ID: <4811A464.4070203@imap.cc> (raw)
In-Reply-To: <480FA9BC.7070205@tiscali.nl>

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

Am 23.04.2008 23:27 schrieb Roel Kluin:
> ifd->offset is unsigned. gigaset_isowbuf_getbytes() may return signed unnoticed

Thanks, good catch. I wonder why neither sparse nor gcc emitted
a warning for that.

> --- a/drivers/isdn/gigaset/bas-gigaset.c
> +++ b/drivers/isdn/gigaset/bas-gigaset.c
> @@ -1050,9 +1050,9 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
>  		}
>  
>  		/* retrieve block of data to send */
> -		ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf,
> -						       ifd->length);
> -		if (ifd->offset < 0) {
> +		rc = gigaset_isowbuf_getbytes(ubc->isooutbuf, ifd->length);
> +		ifd->offset = rc;
> +		if (rc < 0) {
>  			if (ifd->offset == -EBUSY) {
>  				gig_dbg(DEBUG_ISO,
>  					"%s: buffer busy at frame %d",

Please, also replace ifd->offset by rc in the body of the "if (rc < 0)"
and put the assignment to ifd->offset behind it so that it is only done
if rc >= 0. (Frame *ifd is not used in the < 0 case.)

Thanks,
Tilman

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2008-04-25  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23 21:27 [PATCH] gigaset: gigaset_isowbuf_getbytes() may return signed unnoticed Roel Kluin
2008-04-25  9:29 ` Tilman Schmidt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-05-10 17:52 Tilman Schmidt

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=4811A464.4070203@imap.cc \
    --to=tilman@imap.cc \
    --cc=12o3l@tiscali.nl \
    --cc=gigaset307x-common@lists.sourceforge.net \
    --cc=hjlipp@web.de \
    --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