Skip to contentSkip to conversation

USB: ene_ub6250: fix memory leak in ene_load_bincode()

PATCH In review Dan Carpenter 2 participants 2 messages Mar 10, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: ene_ub6250: fix memory leak in ene_load_bincode()

"buf" gets allocated twice in a row. It's the second allocation which is correct. The first one should be removed.

drivers/usb/storage/ene_ub6250.c +0 -4
index 058c5d5..08e0374 100644
@@ -491,10 +491,6 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag)
 	if (info->BIN_FLAG = flag)
 		return USB_STOR_TRANSPORT_GOOD;
 
-	buf = kmalloc(ENE_BIN_CODE_LEN, GFP_KERNEL);
-	if (buf = NULL)
-		return USB_STOR_TRANSPORT_ERROR;
-
 	switch (flag) {
 	/* For SD */
 	case SD_INIT1_PATTERN:
#1 lore raw

Yes, you are right, thanks. :)

Thanks,
--huajun

2011/3/10 Dan Carpenter <[email protected]>:

Quoted 19 lines

"buf" gets allocated twice in a row.  It's the second allocation which is correct.  The first one should be removed.

drivers/usb/storage/ene_ub6250.c +0 -4
index 058c5d5..08e0374 100644
@@ -491,10 +491,6 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag)
        if (info->BIN_FLAG = flag)
                return USB_STOR_TRANSPORT_GOOD;
 
-       buf = kmalloc(ENE_BIN_CODE_LEN, GFP_KERNEL);
-       if (buf = NULL)
-               return USB_STOR_TRANSPORT_ERROR;
-
        switch (flag) {
        /* For SD */
Quoted 2 lines

       case SD_INIT1_PATTERN:

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html