tech-kern archive

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

Re: msdosfs and small sectors



Le 15/07/2014 17:57, Martin Husemann a écrit :
> 
> On Tue, Jul 15, 2014 at 03:27:08PM +0200, Maxime Villard wrote:
>> 'secsize' is retrieved through getdisksize(), via an ioctl on the device.
> 
> force it to be 512 bytes minimum?
> 
> Martin
> 

I thought about that. I haven't found a clear spec on this, but it is
implicitly suggested that 512 is the minimal size (from what I've seen
here and there). And the smallest BytesPerSec allowed for fat devices
is 512. But still, nothing really clear.

Index: msdosfs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/msdosfs/msdosfs_vfsops.c,v
retrieving revision 1.113
diff -u -r1.113 msdosfs_vfsops.c
--- msdosfs_vfsops.c    15 Jul 2014 11:43:54 -0000      1.113
+++ msdosfs_vfsops.c    16 Jul 2014 12:58:52 -0000
@@ -493,6 +493,13 @@
                psize = 0;
                error = 0;
        }
+       if (secsize < DEV_BSIZE) {
+#ifdef DIAGNOSTIC
+               printf("Invalid block secsize %d\n", secsize);
+#endif
+               error = EINVAL;
+               goto error_exit;
+       }
 
        if (argp->flags & MSDOSFSMNT_GEMDOSFS) {
                if (secsize != GEMDOSFS_BSIZE) {


Home | Main Index | Thread Index | Old Index