Skip to contentSkip to conversation

pci: echoaudio: check kmalloc() result

PATCH Applied Kulikov Vasiliy 3 participants 3 messages Jul 16, 2010 – Jul 19, 2010

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

PATCH 11/15 pci: echoaudio: check kmalloc() result

If kmalloc() fails exit with -ENOMEM.

---
 sound/pci/echoaudio/echoaudio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sound/pci/echoaudio/echoaudio.c +2 -0
index 668a5ec..20763dd 100644
@@ -2250,6 +2250,8 @@ static int snd_echo_resume(struct pci_dev *pci)
 	DE_INIT(("resume start\n"));
 	pci_restore_state(pci);
 	commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL);
+	if (commpage_bak == NULL)
+		return -ENOMEM;
 	commpage = chip->comm_page;
 	memcpy(commpage_bak, commpage, sizeof(struct comm_page));
 
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 12 lines · On Fri, 16 Jul 2010 20:15:43 +0400 Kulikov Vasiliy <[email protected]> wrote:

If kmalloc() fails exit with -ENOMEM.

---
 sound/pci/echoaudio/echoaudio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sound/pci/echoaudio/echoaudio.c +0 -0
index 668a5ec..20763dd 100644

sound/pci/echoaudio/echoaudio.c static int snd_echo_resume(struct pci_dev *pci) · line 2257

Quoted 8 lines
sound/pci/echoaudio/echoaudio.c +2 -0
@@ -2250,6 +2250,8 @@ static int snd_echo_resume(struct pci_dev *pci)
 	DE_INIT(("resume start\n"));
 	pci_restore_state(pci);
 	commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL);
+	if (commpage_bak == NULL)
+		return -ENOMEM;
 	commpage = chip->comm_page;
 	memcpy(commpage_bak, commpage, sizeof(struct comm_page));
 

Yes, of course. Thank you.

Signature · 1 line
Giuliano.
#2 lore raw

At Fri, 16 Jul 2010 21:16:50 +0200,

Quoted 28 lines · Giuliano Pochini
Quoted 12 lines · On Fri, 16 Jul 2010 20:15:43 +0400 Kulikov Vasiliy <[email protected]> wrote:

If kmalloc() fails exit with -ENOMEM.

---
 sound/pci/echoaudio/echoaudio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sound/pci/echoaudio/echoaudio.c +0 -0
index 668a5ec..20763dd 100644

sound/pci/echoaudio/echoaudio.c static int snd_echo_resume(struct pci_dev *pci) · line 2257

Quoted 8 lines
sound/pci/echoaudio/echoaudio.c +2 -0
@@ -2250,6 +2250,8 @@ static int snd_echo_resume(struct pci_dev *pci)
 	DE_INIT(("resume start\n"));
 	pci_restore_state(pci);
 	commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL);
+	if (commpage_bak = NULL)
+		return -ENOMEM;
 	commpage = chip->comm_page;
 	memcpy(commpage_bak, commpage, sizeof(struct comm_page));
 

Yes, of course. Thank you.

Quoted 1 line

Applied now. Thanks.

Takashi