From owner-svn-src-head@freebsd.org Mon Jul 15 23:43:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6EF9C6C8F; Mon, 15 Jul 2019 23:43:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA79386093; Mon, 15 Jul 2019 23:43:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 858BB252E2; Mon, 15 Jul 2019 23:43:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6FNhc7X039361; Mon, 15 Jul 2019 23:43:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6FNhcsm039360; Mon, 15 Jul 2019 23:43:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907152343.x6FNhcsm039360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 15 Jul 2019 23:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350020 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 350020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AA79386093 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jul 2019 23:43:38 -0000 Author: imp Date: Mon Jul 15 23:43:38 2019 New Revision: 350020 URL: https://svnweb.freebsd.org/changeset/base/350020 Log: 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: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Mon Jul 15 23:41:00 2019 (r350019) +++ head/sbin/camcontrol/camcontrol.c Mon Jul 15 23:43:38 2019 (r350020) @@ -676,7 +676,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); }