[PATCH 01/02] staging: dgap: Fix how we insure config data is a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch changes the way we insure the config data
is a string. Clearly this was just wrong. After a
certain number of loads/unloads various OOPs were
generated indicating something other than this driver
had a problem. It was this driver.

Signed-off-by: Mark Hounschell <markh@xxxxxxxxxx>
Tested-by: Mark Hounschell <markh@xxxxxxxxxx>
Reported-by: Mark Hounschell <markh@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/dgap/dgap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 3c9278a..e0b8d0f 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -834,7 +834,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
 			return ret;
 		}
 
-		dgap_config_buf = kmalloc(fw->size + 1, GFP_KERNEL);
+		dgap_config_buf = kzalloc(fw->size + 1, GFP_KERNEL);
 		if (!dgap_config_buf) {
 			release_firmware(fw);
 			return -ENOMEM;
@@ -842,7 +842,6 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
 
 		memcpy(dgap_config_buf, fw->data, fw->size);
 		release_firmware(fw);
-		dgap_config_buf[fw->size + 1] = '\0';
 
 		if (dgap_parsefile(&dgap_config_buf, TRUE) != 0) {
 			kfree(dgap_config_buf);
-- 
1.8.4.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux