All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] md.c - null ptr fixes for 2.4.4
@ 2001-05-24  7:33 Praveen Srinivasan
  2001-05-24  7:52 ` Jeff Garzik
  2001-05-24 10:32 ` Neil Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Praveen Srinivasan @ 2001-05-24  7:33 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, alan, mingo

Hi,
This patch fixes some unchecked ptr bugs in the multiple devices driver 
(RAID) code (md.c).

Praveen Srinivasan and Frederick Akalin

--- ../linux/./drivers/md/md.c	Fri Apr  6 10:42:55 2001
+++ ./drivers/md/md.c	Mon May  7 22:08:02 2001
@@ -3756,6 +3756,7 @@
 			continue;
 		}
 		mddev = alloc_mddev(MKDEV(MD_MAJOR,minor));
+
 		if (md_setup_args.pers[minor]) {
 			/* non-persistent */
 			mdu_array_info_t ainfo;
@@ -3773,7 +3774,12 @@
 			ainfo.spare_disks = 0;
 			ainfo.layout = 0;
 			ainfo.chunk_size = md_setup_args.chunk[minor];
-			err = set_array_info(mddev, &ainfo);
+			if(mddev==NULL){
+			    err=1;
+			  }
+			else {
+			  err = set_array_info(mddev, &ainfo);
+			}
 			for (i = 0; !err && (dev = md_setup_args.devices[minor][i]); i++) {
 				dinfo.number = i;
 				dinfo.raid_disk = i;
@@ -3797,9 +3803,12 @@
 		if (!err)
 			err = do_md_run(mddev);
 		if (err) {
-			mddev->sb_dirty = 0;
-			do_md_stop(mddev, 0);
-			printk("md: starting md%d failed\n", minor);
+		  if(mddev !=NULL){
+		    mddev->sb_dirty = 0;
+		    do_md_stop(mddev, 0);
+		  }
+		
+		  printk("md: starting md%d failed\n", minor);
 		}
 	}
 }

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

* Re: [PATCH] md.c - null ptr fixes for 2.4.4
  2001-05-24  7:33 [PATCH] md.c - null ptr fixes for 2.4.4 Praveen Srinivasan
@ 2001-05-24  7:52 ` Jeff Garzik
  2001-05-24 10:32 ` Neil Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2001-05-24  7:52 UTC (permalink / raw)
  To: Praveen Srinivasan; +Cc: torvalds, linux-kernel, alan, mingo

Praveen Srinivasan wrote:
> @@ -3773,7 +3774,12 @@
>                         ainfo.spare_disks = 0;
>                         ainfo.layout = 0;
>                         ainfo.chunk_size = md_setup_args.chunk[minor];
> -                       err = set_array_info(mddev, &ainfo);
> +                       if(mddev==NULL){
> +                           err=1;
> +                         }
> +                       else {
> +                         err = set_array_info(mddev, &ainfo);
> +                       }
>                         for (i = 0; !err && (dev = md_setup_args.devices[minor][i]); i++) {
>                                 dinfo.number = i;
>                                 dinfo.raid_disk = i;
> @@ -3797,9 +3803,12 @@
>                 if (!err)
>                         err = do_md_run(mddev);
>                 if (err) {
> -                       mddev->sb_dirty = 0;
> -                       do_md_stop(mddev, 0);
> -                       printk("md: starting md%d failed\n", minor);
> +                 if(mddev !=NULL){
> +                   mddev->sb_dirty = 0;
> +                   do_md_stop(mddev, 0);
> +                 }
> +
> +                 printk("md: starting md%d failed\n", minor);

coding style of changes totally different from surrounding code, and
Documentation/CodingStyle

ditto for other patches... i didn't check all, only several

-- 
Jeff Garzik      | "Are you the police?"
Building 1024    | "No, ma'am.  We're musicians."
MandrakeSoft     |

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

* Re: [PATCH] md.c - null ptr fixes for 2.4.4
  2001-05-24  7:33 [PATCH] md.c - null ptr fixes for 2.4.4 Praveen Srinivasan
  2001-05-24  7:52 ` Jeff Garzik
@ 2001-05-24 10:32 ` Neil Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Brown @ 2001-05-24 10:32 UTC (permalink / raw)
  To: Praveen Srinivasan; +Cc: torvalds, linux-kernel, alan, mingo

On Thursday May 24, praveens@stanford.edu wrote:
> Hi,
> This patch fixes some unchecked ptr bugs in the multiple devices driver 
> (RAID) code (md.c).
> 
> Praveen Srinivasan and Frederick Akalin

Thankyou.
However I suspect that a much simpler patch would be:

--- ../linux/./drivers/md/md.c	Fri Apr  6 10:42:55 2001
+++ ./drivers/md/md.c	Mon May  7 22:08:02 2001
@@ -3756,6 +3756,10 @@
 			continue;
 		}
 		mddev = alloc_mddev(MKDEV(MD_MAJOR,minor));
+		if (mddev == NULL) {
+			printk("md: kmalloc failed - cannot start array %d\n", minor);
+			continue;
+		}
 		if (md_setup_args.pers[minor]) {
 			/* non-persistent */
 			mdu_array_info_t ainfo;


WARNING - patch created by hand, not tested.

If this is an issue. i.e. if alloc_mddev fails this early in the boot 
sequence, then I think you have a very sick computer...

NeilBrown

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

end of thread, other threads:[~2001-05-24 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-24  7:33 [PATCH] md.c - null ptr fixes for 2.4.4 Praveen Srinivasan
2001-05-24  7:52 ` Jeff Garzik
2001-05-24 10:32 ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.