svn commit: r350729 - stable/12/sbin/camcontrol
Alexander Motin
mav at FreeBSD.org
Thu Aug 8 02:21:30 UTC 2019
Author: mav
Date: Thu Aug 8 02:21:30 2019
New Revision: 350729
URL: https://svnweb.freebsd.org/changeset/base/350729
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/12/sbin/camcontrol/camcontrol.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sbin/camcontrol/camcontrol.c
==============================================================================
--- stable/12/sbin/camcontrol/camcontrol.c Thu Aug 8 02:20:42 2019 (r350728)
+++ stable/12/sbin/camcontrol/camcontrol.c Thu Aug 8 02:21:30 2019 (r350729)
@@ -694,7 +694,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);
}
More information about the svn-src-stable-12
mailing list