Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2018 19:57:57 -1000 (HST)
From:      Jeff Roberson <jroberson@jroberson.net>
To:        Justin Hibbits <jhibbits@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r331233 - head/sys/kern
Message-ID:  <alpine.BSF.2.21.1803191957370.2307@desktop>
In-Reply-To: <201803200201.w2K21UgY079589@repo.freebsd.org>
References:  <201803200201.w2K21UgY079589@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for fixing my bug.  Sorry I didn't build universe for this one.

Thanks,
Jeff

On Tue, 20 Mar 2018, Justin Hibbits wrote:

> Author: jhibbits
> Date: Tue Mar 20 02:01:30 2018
> New Revision: 331233
> URL: https://svnweb.freebsd.org/changeset/base/331233
>
> Log:
>  Cast through uintptr_t to narrow the buf domain pointer on 32-bit archs
>
>  arg2 is an intmax_t, which on 32-bit architectures is 64 bits, wider than a
>  pointer.  When &bdomain[i] is added to arg2 it widens from uintptr_t to
>  intmax_t, then gcc whines when it gets cast to a pointer.  Casting through
>  uintptr_t silences this warning.
>
> Modified:
>  head/sys/kern/vfs_bio.c
>
> Modified: head/sys/kern/vfs_bio.c
> ==============================================================================
> --- head/sys/kern/vfs_bio.c	Tue Mar 20 01:33:04 2018	(r331232)
> +++ head/sys/kern/vfs_bio.c	Tue Mar 20 02:01:30 2018	(r331233)
> @@ -435,7 +435,7 @@ sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS)
> 		return (error);
> 	*(int *)arg1 = value;
> 	for (i = 0; i < buf_domains; i++)
> -		*(int *)(((uintptr_t)&bdomain[i]) + arg2) =
> +		*(int *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) =
> 		    value / buf_domains;
>
> 	return (error);
> @@ -454,7 +454,7 @@ sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS)
> 		return (error);
> 	*(long *)arg1 = value;
> 	for (i = 0; i < buf_domains; i++)
> -		*(long *)(((uintptr_t)&bdomain[i]) + arg2) =
> +		*(long *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) =
> 		    value / buf_domains;
>
> 	return (error);
>



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