diff applied, kernel made, tested, works. thanks, Ken!

Bye, Marcus

kwesterb...@rogers.com (Kenneth R Westerback), 2012.09.04 (Tue) 15:57 (CEST):
> On Tue, Sep 04, 2012 at 02:56:40PM +0200, MERIGHI Marcus wrote:
> > with the diff below my ``panic: smashed stack in msdosfs_rename''
> > problem does not appear any more. 
> > 
> > Index: msdosfs_vnops.c
> > ===================================================================
> > RCS file: /cvs/src/sys/msdosfs/msdosfs_vnops.c,v
> > retrieving revision 1.82
> > diff -u -r1.82 msdosfs_vnops.c
> > --- msdosfs_vnops.c 11 Jul 2012 12:39:20 -0000      1.82
> > +++ msdosfs_vnops.c 4 Sep 2012 09:28:32 -0000
> > @@ -860,7 +860,7 @@
> >     struct componentname *fcnp = ap->a_fcnp;
> >     struct proc *p = curproc; /* XXX */
> >     struct denode *ip, *xp, *dp, *zp;
> > -   u_char toname[11], oldname[11];
> > +   u_char toname[12], oldname[11];
> >     uint32_t from_diroffset, to_diroffset;
> >     u_char to_count;
> >     int doingdirectory = 0, newparent = 0;
> > 
> > below is my lengthy report to bugs@ with some explanation.
> > 
> > Bye, Marcus
> 
> The problem seems to be rooted in a desire to printf() the dosname
> in a debug statement. Otherwise the dos file names are not treated
> as strings anywhere.
> 
> An alternate solution, that restores the symmetry between unix2dosfn()
> and dos2unixfn(), is to use %.11s to print the dos file name in that
> debug chunk, and otherwise consistantly treat the various dos file
> names as 11-byte arrays.
> 
> Eliminiating one magic number (12) would seem a good thing. :-)
> 
> Comments about the non-stringiness of these vars might be good too.
> 
> .... Ken
> 
> Index: msdosfs_conv.c
> ===================================================================
> RCS file: /cvs/src/sys/msdosfs/msdosfs_conv.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 msdosfs_conv.c
> --- msdosfs_conv.c    13 Aug 2009 22:34:29 -0000      1.14
> +++ msdosfs_conv.c    4 Sep 2012 13:45:37 -0000
> @@ -403,7 +403,7 @@ dos2unixfn(u_char dn[11], u_char *un, in
>   *   3 if conversion was successful and generation number was inserted
>   */
>  int
> -unix2dosfn(u_char *un, u_char dn[12], int unlen, u_int gen)
> +unix2dosfn(u_char *un, u_char dn[11], int unlen, u_int gen)
>  {
>       int i, j, l;
>       int conv = 1;
> @@ -416,7 +416,6 @@ unix2dosfn(u_char *un, u_char dn[12], in
>        */
>       for (i = 0; i < 11; i++)
>               dn[i] = ' ';
> -     dn[11] = 0;
>       
>       /*
>        * The filenames "." and ".." are handled specially, since they
> Index: msdosfs_lookup.c
> ===================================================================
> RCS file: /cvs/src/sys/msdosfs/msdosfs_lookup.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 msdosfs_lookup.c
> --- msdosfs_lookup.c  4 Jul 2011 04:30:41 -0000       1.24
> +++ msdosfs_lookup.c  4 Sep 2012 13:38:29 -0000
> @@ -104,7 +104,7 @@ msdosfs_lookup(void *v)
>       struct msdosfsmount *pmp;
>       struct buf *bp = 0;
>       struct direntry *dep;
> -     u_char dosfilename[12];
> +     u_char dosfilename[11];
>       u_char *adjp;
>       int adjlen;
>       int flags;
> @@ -193,7 +193,7 @@ msdosfs_lookup(void *v)
>               slotcount = 0;
>       
>  #ifdef MSDOSFS_DEBUG
> -     printf("msdosfs_lookup(): dos version of filename %s, length %d\n",
> +     printf("msdosfs_lookup(): dos version of filename '%.11s', length %d\n",
>           dosfilename, cnp->cn_namelen);
>  #endif
>       /*
> 
> 
> !DSPAM:50460b4a202476375431200!

Reply via email to