From: Dan Carpenter <error27@gmail.com>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: Kernel Janitors <kernel-janitors@vger.kernel.org>,
Doug Gilbert <dgilbert@interlog.com>,
"James E.J. Bottomley" <James.Bottomley@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Jens Axboe <jens.axboe@oracle.com>,
Alexey Dobriyan <adobriyan@gmail.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 10/25] scsi/sg: remove casts from void*
Date: Thu, 01 Jul 2010 17:38:05 +0000 [thread overview]
Message-ID: <20100701173805.GW19184@bicker> (raw)
In-Reply-To: <1277990204-22157-1-git-send-email-segooon@gmail.com>
On Thu, Jul 01, 2010 at 05:16:43PM +0400, Kulikov Vasiliy wrote:
> - Sg_fd *sfp;
> + Sg_fd *sfp = filp->private_data;
^^^^^^^^^^^^^^^^^^
Dereferenced here.
> unsigned long req_sz, len, sa;
> Sg_scatter_hold *rsv_schp;
> int k, length;
>
> - if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data)))
> + if ((!filp) || (!vma) || !(sfp))
^^^^^
Checked here.
I obviously just spotted that during the review but another way would be
to use smatch to catch these. (http://smatch.sf.net)
$ /path/to/smatch_scripts/kchecker drivers/scsi/sg.c
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHECK drivers/scsi/sg.c
drivers/scsi/sg.c +1236 sg_mmap(7) warn: variable dereferenced before check 'filp'
CC [M] drivers/scsi/sg.o
$
You could also get rid of the extra parenthesis.
+ if (!filp || !vma || !sfp)
> return -ENXIO;
> req_sz = vma->vm_end - vma->vm_start;
> SCSI_LOG_TIMEOUT(3, printk("sg_mmap starting, vm_start=%p, len=%d\n",
Btw. These are _way_ better than when you sent them the first time.
Thanks for doing resending them.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: Kernel Janitors <kernel-janitors@vger.kernel.org>,
Doug Gilbert <dgilbert@interlog.com>,
"James E.J. Bottomley" <James.Bottomley@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Jens Axboe <jens.axboe@oracle.com>,
Alexey Dobriyan <adobriyan@gmail.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 10/25] scsi/sg: remove casts from void*
Date: Thu, 1 Jul 2010 19:38:05 +0200 [thread overview]
Message-ID: <20100701173805.GW19184@bicker> (raw)
In-Reply-To: <1277990204-22157-1-git-send-email-segooon@gmail.com>
On Thu, Jul 01, 2010 at 05:16:43PM +0400, Kulikov Vasiliy wrote:
> - Sg_fd *sfp;
> + Sg_fd *sfp = filp->private_data;
^^^^^^^^^^^^^^^^^^
Dereferenced here.
> unsigned long req_sz, len, sa;
> Sg_scatter_hold *rsv_schp;
> int k, length;
>
> - if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data)))
> + if ((!filp) || (!vma) || !(sfp))
^^^^^
Checked here.
I obviously just spotted that during the review but another way would be
to use smatch to catch these. (http://smatch.sf.net)
$ /path/to/smatch_scripts/kchecker drivers/scsi/sg.c
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHECK drivers/scsi/sg.c
drivers/scsi/sg.c +1236 sg_mmap(7) warn: variable dereferenced before check 'filp'
CC [M] drivers/scsi/sg.o
$
You could also get rid of the extra parenthesis.
+ if (!filp || !vma || !sfp)
> return -ENXIO;
> req_sz = vma->vm_end - vma->vm_start;
> SCSI_LOG_TIMEOUT(3, printk("sg_mmap starting, vm_start=%p, len=%d\n",
Btw. These are _way_ better than when you sent them the first time.
Thanks for doing resending them.
regards,
dan carpenter
next prev parent reply other threads:[~2010-07-01 17:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-01 13:16 [PATCH 10/25] scsi/sg: remove casts from void* Kulikov Vasiliy
2010-07-01 13:16 ` Kulikov Vasiliy
2010-07-01 17:38 ` Dan Carpenter [this message]
2010-07-01 17:38 ` Dan Carpenter
2010-07-01 18:27 ` Kulikov Vasiliy
2010-07-01 18:27 ` Kulikov Vasiliy
2010-07-01 18:27 ` Kulikov Vasiliy
2010-07-02 7:04 ` Kulikov Vasiliy
2010-07-02 7:04 ` Kulikov Vasiliy
2010-07-02 7:04 ` Kulikov Vasiliy
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=20100701173805.GW19184@bicker \
--to=error27@gmail.com \
--cc=James.Bottomley@suse.de \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dgilbert@interlog.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=jens.axboe@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=segooon@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.