From: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>
To: Ken Ashcraft <ken@coverity.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [CHECKER] Implementation inconsistencies in 2.6.3
Date: Tue, 27 Apr 2004 15:14:46 -0700 [thread overview]
Message-ID: <20040427221446.GA2662@one-eyed-alien.net> (raw)
In-Reply-To: <4448.171.64.70.113.1083102442.spork@webmail.coverity.com>
[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]
On Tue, Apr 27, 2004 at 02:47:22PM -0700, Ken Ashcraft wrote:
> I'm trying to cross check implementations of the same interface for
> errors. I assume that if functions are assigned to the same function
> pointer, they are implementations of a common interface and should be
> consistent with each other. For example, if one implementation checks one
> of its arguments for NULL, the other implementation should also check that
> argument for NULL.
>
> In this case, I'm looking at which arguments are referenced at all in the
> implementation. If we have 10 implementations and 9 of them read argument
> 1 and the 10th fails to read argument 1, the 10th implementation may be
> missing some code. In each of the reports below, I give an example
> implementation that does read the argument. That is followed by an
> implementation that fails to read the argument.
>
> ---------------------------------------------------------
> [BUG] (mdharm-usb@one-eyed-alien.net) looks like it should return count
> instead of strlen(buf), but this is in scsiglue.c, so is it special code?
>
> example:
> /home/kash/linux/2.6.3/linux-2.6.3/drivers/scsi/scsi_sysfs.c:274:store_rescan_field:
> NOTE:READ: Checking arg count [EXAMPLE=device_attribute.store-2]
>
> /home/kash/linux/2.6.3/linux-2.6.3/drivers/usb/storage/scsiglue.c:321:store_max_sectors:
> ERROR:READ: Not checking arg [COUNTER=device_attribute.store-2] [fit=1]
> [fit_fn=1] [fn_ex=0] [fn_counter=1] [ex=233] [counter=1] [z =
> 3.20943839741638] [fn-z = -4.35889894354067]
>
> return sprintf(buf, "%u\n", sdev->request_queue->max_sectors);
> }
>
> /* Input routine for the sysfs max_sectors file */
>
> Error --->
> static ssize_t store_max_sectors(struct device *dev, const char *buf,
> size_t count)
> {
> struct scsi_device *sdev = to_scsi_device(dev);
My understanding was that I was supposed to return the number of bytes in
the buffer that I actually used. I thought 'count' was the maximum size I
could use.
Is that not the case?
Matt
--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver
Oh great modem, why hast thou forsaken me?
-- Dust Puppy
User Friendly, 3/2/1998
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-04-27 22:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-27 21:47 Ken Ashcraft
2004-04-27 22:14 ` Matthew Dharm [this message]
2004-04-27 22:58 ` Ken Ashcraft
2004-04-27 23:05 ` Matthew Dharm
2004-04-28 0:13 ` Richard B. Johnson
2004-04-28 16:15 ` Krzysztof Halasa
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=20040427221446.GA2662@one-eyed-alien.net \
--to=mdharm-kernel@one-eyed-alien.net \
--cc=ken@coverity.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
all inboxes | Powered by JetHome®