* [PATCH 1/4] drivers/block: adjust NULL test
@ 2009-07-13 20:43 Julia Lawall
2009-07-17 6:31 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2009-07-13 20:43 UTC (permalink / raw)
To: linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
dtp is derefenced on the lines above the test !dtp, and so it cannot be
NULL at this point.
A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r@
expression x,E,E1;
identifier f,l;
position p1,p2;
@@
*x@p1->f = E1;
... when != x = E
when != goto l;
(
*x@p2 == NULL
|
*x@p2 != NULL
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/block/ataflop.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index f5e7180..3ff0294 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1627,7 +1627,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode,
drive, dtp->blocks, dtp->spt, dtp->stretch);
/* sanity check */
- if (!dtp || setprm.track != dtp->blocks/dtp->spt/2 ||
+ if (setprm.track != dtp->blocks/dtp->spt/2 ||
setprm.head != 2) {
redo_fd_request();
return -EINVAL;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/4] drivers/block: adjust NULL test
2009-07-13 20:43 [PATCH 1/4] drivers/block: adjust NULL test Julia Lawall
@ 2009-07-17 6:31 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2009-07-17 6:31 UTC (permalink / raw)
To: Julia Lawall; +Cc: linux-kernel, kernel-janitors
Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> dtp is derefenced on the lines above the test !dtp, and so it cannot be
> NULL at this point.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://www.emn.fr/x-info/coccinelle/)
>
> // <smpl>
> @r@
> expression x,E,E1;
> identifier f,l;
> position p1,p2;
> @@
>
> *x@p1->f = E1;
> ... when != x = E
> when != goto l;
> (
> *x@p2 == NULL
> |
> *x@p2 != NULL
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Indeed, added to my temp block tree. Will forward upstream in a few
days.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-17 6:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-13 20:43 [PATCH 1/4] drivers/block: adjust NULL test Julia Lawall
2009-07-17 6:31 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox