linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Some error checking on kmalloc()'s in ide-probe.c
@ 2001-06-14 13:34 Stephen Shirley
  2001-06-14 17:17 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Shirley @ 2001-06-14 13:34 UTC (permalink / raw)
  To: andre; +Cc: linux-kernel

Mornin,
	This patch adds error checking to the return value of kmalloc() in
2 places in ide-probe.c. It's against 2.4.5.y

Steve

--- ide-probe.c.orig    Thu Jun 14 14:05:31 2001
+++ ide-probe.c Thu Jun 14 14:15:12 2001
@@ -58,6 +58,11 @@
        struct hd_driveid *id;

        id = drive->id = kmalloc (SECTOR_WORDS*4, GFP_ATOMIC);  /* called with interrupts disabled! */
+       if(id == NULL)
+       {
+               printk(KERN_ERR "ide-probe: Failed to allocate memory for hd_driveid struct, aborting\n");
+               return;
+       }
        ide_input_data(drive, id, SECTOR_WORDS);                /* read 512 bytes of id info */
        ide__sti();     /* local CPU only */
        ide_fix_driveid(id);
@@ -623,6 +628,11 @@
        /* Allocate the buffer and potentially sleep first */

        new_hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL);
+       if(new_hwgroup == NULL)
+       {
+               printk(KERN_ERR "ide-probe: Failed to allocate memory for hwgroup, aborting\n");
+               return 1;
+       }

        save_flags(flags);      /* all CPUs */
        cli();                  /* all CPUs */


-- 
"My mom had Windows at work and it hurt her eyes real bad"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Some error checking on kmalloc()'s in ide-probe.c
  2001-06-14 13:34 [PATCH] Some error checking on kmalloc()'s in ide-probe.c Stephen Shirley
@ 2001-06-14 17:17 ` Alan Cox
  2001-06-15 10:07   ` Stephen Shirley
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2001-06-14 17:17 UTC (permalink / raw)
  To: Stephen Shirley; +Cc: andre, linux-kernel

> Mornin,
> 	This patch adds error checking to the return value of kmalloc() in
> 2 places in ide-probe.c. It's against 2.4.5.y

These are already fixed in the -ac tree

Please people - check the -ac tree before wasting time on these


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Some error checking on kmalloc()'s in ide-probe.c
  2001-06-14 17:17 ` Alan Cox
@ 2001-06-15 10:07   ` Stephen Shirley
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Shirley @ 2001-06-15 10:07 UTC (permalink / raw)
  To: Alan Cox; +Cc: andre, linux-kernel

On Thu, 14 Jun 2001, Alan Cox wrote:

> These are already fixed in the -ac tree
>
> Please people - check the -ac tree before wasting time on these
>

Hmm - I did indeed forget to check the -ac tree, I have done so now, and
there is no difference between the vanilla kernel and the -ac one in
those places that i can see. The second fix is not needed after closer
inspection (mea culpa), but the first is still valid AFAICS.

Steve
Ps. Apologise if I've fumbled it again.


--- ide-probe.c.orig    Thu Jun 14 14:05:31 2001
+++ ide-probe.c Fri Jun 15 11:03:17 2001
@@ -58,6 +58,11 @@
        struct hd_driveid *id;

        id = drive->id = kmalloc (SECTOR_WORDS*4, GFP_ATOMIC);  /* called with interrupts disabled! */
+       if(id == NULL)
+       {
+               printk(KERN_ERR "ide-probe: Failed to allocate memory for hd_driveid struct, aborting\n");
+               return;
+       }
        ide_input_data(drive, id, SECTOR_WORDS);                /* read 512 bytes of id info */
        ide__sti();     /* local CPU only */
        ide_fix_driveid(id);


-- 
"My mom had Windows at work and it hurt her eyes real bad"


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-06-15 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-14 13:34 [PATCH] Some error checking on kmalloc()'s in ide-probe.c Stephen Shirley
2001-06-14 17:17 ` Alan Cox
2001-06-15 10:07   ` Stephen Shirley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).