From: Chuck Short Date: Tue, 26 Sep 2006 05:31:03 +0000 (-0700) Subject: [IRDA] via-ircc: fix memory leak X-Git-Tag: v2.6.19-rc1~858^2~158 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83e331e2a492a134e491bcf50c984fd50c7fae03;p=linux-2.6 [IRDA] via-ircc: fix memory leak Fix memory leak. Coverity id# 653 patch location: http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=a1f34cb68b16807ed9d5ebb0f6a6ec5ff8a5fc78 Signed-off-by: Chuck Short Signed-off-by: Ben Collins Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 79b85f3275..d916e1257c 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c @@ -1223,8 +1223,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase) IRDA_DEBUG(2, "%s(): len=%x\n", __FUNCTION__, len); + if ((len - 4) < 2) { + self->stats.rx_dropped++; + return FALSE; + } + skb = dev_alloc_skb(len + 1); - if ((skb == NULL) || ((len - 4) < 2)) { + if (skb == NULL) { self->stats.rx_dropped++; return FALSE; }