NetBSD-Bugs archive

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

Re: kern/47806 ("Abort trap" when running Linux lddconfig)



The following reply was made to PR kern/47806; it has been noted by GNATS.

From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
        netbsd-bugs%netbsd.org@localhost, Thomas Klausner 
<wiz%NetBSD.org@localhost>
Subject: Re: kern/47806 ("Abort trap" when running Linux lddconfig)
Date: Tue, 3 Sep 2013 08:41:34 +0100

 On Tue, Aug 27, 2013 at 10:20:01PM +0000, Sergio Lopez wrote:
 >  Index: linux_misc.c
 >  ===================================================================
 >  RCS file: /cvsroot/src/sys/compat/linux/common/linux_misc.c,v
 >  retrieving revision 1.224
 >  diff -u -r1.224 linux_misc.c
 >  --- linux_misc.c    11 Aug 2013 09:07:15 -0000      1.224
 >  +++ linux_misc.c    27 Aug 2013 21:01:06 -0000
 >  @@ -786,7 +786,7 @@
 >                      idb.d_reclen = (u_short)linux_reclen;
 >              }
 >              strcpy(idb.d_name, bdp->d_name);
 >  -           idb.d_name[strlen(idb.d_name) + 1] = bdp->d_type;
 >  +           *((char *)&idb + idb.d_reclen - 1) = bdp->d_type;
 >              if ((error = copyout((void *)&idb, outp, linux_reclen)))
 >                      goto out;
 >              /* advance past this real entry */
 
 FWIW I'd guess that the strcpy() can be replaced by a faster memcpy()
 since the length must already be known.
 
 Also (contradicting someone else) d_reclen has been calculated using
 ALIGN() - probably best to only use ALIGN once.
 
 If you write in into both places, add a comment to explain why.
 
        David
 
 -- 
 David Laight: david%l8s.co.uk@localhost
 


Home | Main Index | Thread Index | Old Index