Skip to content

Commit

Permalink
ataflop: adjust NULL test
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Julia Lawall authored and Tejun Heo committed Jul 17, 2009
1 parent 0a09f43 commit 8f47428
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/ataflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8f47428

Please sign in to comment.