Port-amiga archive

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

How-to add patch to kernel source?



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@localhost>
To: petri.koistinen%iki.fi@localhost
Cc: gnats-bugs%netbsd.org@localhost
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;

-- 
-- Todd Vierling <tv%wasabisystems.com@localhost>  *  
http://www.wasabisystems.com/
-- Speed, stability, security, and support.  Wasabi NetBSD:  Run with it.




Home | Main Index | Thread Index | Old Index