From: Jan Vesely Subject: Re: [PATCH 2/2] Fix one warning Date: Fri, 24 Apr 2015 10:30:18 -0400 Message-ID: <1429885818.6006.11.camel@rutgers.edu> References: <1429847046-12807-1-git-send-email-Jammy.Zhou@amd.com> <1429847046-12807-2-git-send-email-Jammy.Zhou@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1073143629==" Return-path: Received: from mail-vn0-f50.google.com (mail-vn0-f50.google.com [209.85.216.50]) by gabe.freedesktop.org (Postfix) with ESMTP id A26516E2BC for ; Fri, 24 Apr 2015 07:30:26 -0700 (PDT) Received: by vnbg7 with SMTP id g7so4124000vnb.10 for ; Fri, 24 Apr 2015 07:30:26 -0700 (PDT) In-Reply-To: <1429847046-12807-2-git-send-email-Jammy.Zhou@amd.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Jammy Zhou Cc: Frank.Min@amd.com, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1073143629== Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-R+1VRQu4QmvRVub0E0hj" --=-R+1VRQu4QmvRVub0E0hj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2015-04-24 at 11:44 +0800, Jammy Zhou wrote: > xf86drm.c:356:2: warning: comparison of unsigned expression >=3D 0 is alw= ays true [-Wtype-limits] > group =3D (serv_group >=3D 0) ? serv_group : DRM_DEV_GID; > ^ >=20 > Signed-off-by: Jammy Zhou > --- > xf86drm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/xf86drm.c b/xf86drm.c > index 4d67861..fbda2aa 100644 > --- a/xf86drm.c > +++ b/xf86drm.c > @@ -353,7 +353,7 @@ static int drmOpenDevice(dev_t dev, int minor, int ty= pe) > } > =20 > if (drm_server_info) { > - group =3D (serv_group >=3D 0) ? serv_group : DRM_DEV_GID; > + group =3D serv_group; I don't think this change is correct. get_perms can return errors as negative values. I found that xserver does, see [0] for my take on fixing this, as well as Emil's response [1]. I think changing the condition to: ((int)serv_group >=3D 0) should be ok(I don't think there are systems with GID_MAX greater than 2^31-1), but I never bothered sending v2. jan [0]http://lists.freedesktop.org/archives/dri-devel/2015-February/077276.htm= l [1]http://lists.freedesktop.org/archives/dri-devel/2015-February/078171.htm= l > chown_check_return(buf, user, group); > chmod(buf, devmode); > } --=20 Jan Vesely --=-R+1VRQu4QmvRVub0E0hj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCgAGBQJVOlN6AAoJEOCQZixVs7KB/z0P/iWckyZwIk7FQ2FgpwBeJ8ha tyX8bDvVW903TGc1dmzydr62ifHjPbsCHnsSI1HlyyJ9bjgi2riFipNDN2oSQrve Z+oC6w8lY9ZUfOYbC+yU8lpeFOunt/PngLZDIbuA8n9bbYvbfcR943y3wd5vBJWc /4lp5F+ik3tHs0EUblTn9ujJGaa+EuhZVYdiF30nCFh91i/1NYlG4/DewSQ17bKZ m6z0/pRiU85JtzXNA8EgVwEJCf8tJYYx7oDnmkwzTE7R0PhLmniHPpexFcDQ+VSK b1xVgSEa1PbMIZ4zq45cZV5JIeioJrSpGzcPZV7f23Fv8pxvWiFmooylhptbnUGk YkWtMwMHUcCkbKszO8MZ8kV7NNa/xVRiPi/+RKIfmkUO+guSKi04xzJZbEAl36F5 edrawAe/BREetOfiTMpYMtfnFN4uPanHDXZR/IvT0udSV4BJ6ML40jVB8owyFz2A d9CnHiZEPRnL1gxaEfLBYO1Ybw9cLue2KTdvY+qGxqPRqZzlwAGZN86Zr2gcRGf8 IHq+Lgdp2dOVc8JmsMVJV+9awCnPWQ3XrJzQCMGG81OJe5b7puM2QPCv+eoA57vz +akNUo9iIJuH7nYy1gHHnPucxD7Y1A1u72lp1gb3hRjfJFzavU8ecDyCYGOxFP+J eAFsZGSC4xnLD4d7hylT =Jz+/ -----END PGP SIGNATURE----- --=-R+1VRQu4QmvRVub0E0hj-- --===============1073143629== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9kcmktZGV2ZWwK --===============1073143629==--