Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f37c54b6 authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller
Browse files

drivers/net/ethernet/ti/davinci_cpdma.c: Remove potential NULL dereference

If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.

The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/

)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aadf31de
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -538,11 +538,12 @@ EXPORT_SYMBOL_GPL(cpdma_chan_create);

int cpdma_chan_destroy(struct cpdma_chan *chan)
{
	struct cpdma_ctlr *ctlr = chan->ctlr;
	struct cpdma_ctlr *ctlr;
	unsigned long flags;

	if (!chan)
		return -EINVAL;
	ctlr = chan->ctlr;

	spin_lock_irqsave(&ctlr->lock, flags);
	if (chan->state != CPDMA_STATE_IDLE)