Date: Thu, 8 Aug 2019 22:03:36 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r350798 - stable/11/sbin/camcontrol Message-ID: <201908082203.x78M3ar9041212@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Aug 8 22:03:36 2019 New Revision: 350798 URL: https://svnweb.freebsd.org/changeset/base/350798 Log: MFC r350020 (by imp): Use a different approach to range check. gcc hates dt < CC_DT_NONE since it can never be true when dt is an unsigned type. Since that's a compiler choice and may be affected by weird stuff, instead use (unsigned)dt > CC_DT_UNKNOWN to test for bounds error since that will work regardless of the signedness of dt. Modified: stable/11/sbin/camcontrol/camcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Thu Aug 8 22:03:01 2019 (r350797) +++ stable/11/sbin/camcontrol/camcontrol.c Thu Aug 8 22:03:36 2019 (r350798) @@ -691,7 +691,7 @@ getdevtype(struct cam_device *cam_dev) * Get the device type and report it, request no I/O be done to do this. */ error = get_device_type(cam_dev, -1, 0, 0, &dt); - if (error != 0 || dt < CC_DT_NONE || dt > CC_DT_UNKNOWN) { + if (error != 0 || (unsigned)dt > CC_DT_UNKNOWN) { fprintf(stdout, "illegal\n"); return (1); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908082203.x78M3ar9041212>