Re: [PATCH] gigaset: gigaset_isowbuf_getbytes() may return signedunnoticed

From: Tilman Schmidt
Date: Fri Apr 25 2008 - 05:29:31 EST


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@xxxxxxx
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)

Attachment: signature.asc
Description: OpenPGP digital signature