Subject: Re: How-to add patch to kernel source?
To: Petri Koistinen <pkoistin@hit.fi>
From: David Brownlee <abs@netbsd.org>
List: port-amiga
Date: 11/07/2000 16:38:57
	Take a look at
	http://www.netbsd.org/Documentation/kernel/#how_to_build_a_kernel

                David/absolute
			       -- www.netbsd.org: A pmap for every occasion --


On Mon, 6 Nov 2000, Petri Koistinen wrote:

> Hi!
>
> I found a bug in NetBSD system a while ago. I filled up a problem report
> and soon after it I got message back with possible fix to the problem.
>
> My problem is that I don't know how-to apply this patch to kernel sources.
> I have compiled kernel by myself about two times on NetBSD. I know that I
> have to get kernel sources from
> ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-1.5_BETA2/source/syssrc.tgz.
>
> But what shall I do after I have installed them in my system?
>
> Thanks for help.
>
> Regards
> Petri Koistinen
>
> Here is the suggested patch:
>
> ---------- Forwarded message ----------
> Date: Sun, 5 Nov 2000 23:07:55 -0500 (EST)
> From: Todd Vierling <tv@wasabisystems.com>
> To: petri.koistinen@iki.fi
> Cc: gnats-bugs@netbsd.org
> Subject: Re: kern/11335: Using mount_ados with iso9660 CD-ROM will cause kernel
>     panic.
>
> Here's a prospective fix that will move the division operation past the
> validation that the fs is really an AmigaDOS partition.  Can you please test
> a kernel with this patch?
>
> The fixed kernel should make mount_ados fail with "Invalid argument" instead
> on a ffs filesystem.
>
> --- sys/adosfs/advfsops.c	2000/03/16 18:08:21	1.42
> +++ sys/adosfs/advfsops.c	2000/11/06 04:05:26
> @@ -211,8 +211,6 @@
>  		amp->bsize = parp->p_fsize * parp->p_frag;
>  		amp->secsperblk = parp->p_frag;
>  	}
> -	amp->rootb = (parp->p_size / amp->secsperblk - 1 + parp->p_cpg) >> 1;
> -	amp->numblks = parp->p_size / amp->secsperblk - parp->p_cpg;
>
>  	bp = NULL;
>  	if ((error = bread(devvp, (daddr_t)BBOFF,
> @@ -228,6 +226,8 @@
>  		goto fail;
>  	}
>
> +	amp->rootb = (parp->p_size / amp->secsperblk - 1 + parp->p_cpg) >> 1;
> +	amp->numblks = parp->p_size / amp->secsperblk - parp->p_cpg;
>  	amp->nwords = amp->bsize >> 2;
>  	amp->dbsize = amp->bsize - (IS_FFS(amp) ? 0 : OFS_DATA_OFFSET);
>  	amp->devvp = devvp;
>
>