Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2020 19:47:06 +0100
From:      Martin Simmons <martin@lispworks.com>
To:        "Mikhail T." <mi+t@aldan.algebra.com>
Cc:        jkim@FreeBSD.org, mmokhi@FreeBSD.org, vbox@FreeBSD.org
Subject:   Re: Old bug in patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vfsops.c
Message-ID:  <202006231847.05NIl6eH007223@higson.cam.lispworks.com>
In-Reply-To: <101fc234-e5c2-e8c3-9c07-3eb922c01736@aldan.algebra.com> (mi%2Bt@aldan.algebra.com)
References:  <101fc234-e5c2-e8c3-9c07-3eb922c01736@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Is the memcpy wrong too?  It looks like fsinfo.serial is a single uint32_t
(i.e. 32 bits), but mp->mnt_stat.f_fsid is a pair of int32_t (i.e. 64 bits),
so copying this pair from fsinfo.serial is wrong.

__Martin


>>>>> On Mon, 22 Jun 2020 14:22:05 -0400, Mikhail T said:
> 
> Gentlemen!
> 
> An old bug in the patch is causing compiler-warnings, and leads to 
> erroneous behavior where pointers are bigger than 32-bit.
> 
> Moreover, given the memcpy right after it, the bzero is simply not 
> needed at all. Instead of removing the bogus ampersand, the entire line 
> should be deleted. (I would've replaced the memcpy with an assignment 
> too, but that's not as pressing.)
> 
> Can I commit this?
> 
>     Index: files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vfsops.c
>     ===================================================================
>     --- files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vfsops.c
>     (revision 539883)
>     +++ files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vfsops.c
>     (working copy)
>     @@ -11,7 +11,7 @@
>         *
>         * This file is part of VirtualBox Open Source Edition (OSE), as
>         * available from http://www.virtualbox.org. This file is free
>     software;
>     -@@ -14,245 +9,479 @@
>     +@@ -14,245 +9,478 @@
>         * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
>         * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
>         */
>     @@ -466,7 +466,6 @@
>       +
>       +      MNT_ILOCK(mp);
>       +      mp->mnt_data = vboxfsmp;
>     *-+      bzero(&mp->mnt_stat.f_fsid, sizeof(&mp->mnt_stat.f_fsid));*
>       +      /* f_fsid is int32_t but serial is uint32_t, convert */
>       +      memcpy(&mp->mnt_stat.f_fsid, &fsinfo.serial,
>     sizeof(mp->mnt_stat.f_fsid));
>       +      mp->mnt_flag |= MNT_LOCAL;
> 
> Thanks. Yours,
> 
>     -mi
> 
> _______________________________________________
> freebsd-emulation@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-emulation
> To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org"
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006231847.05NIl6eH007223>