From nobody Thu Jan 13 22:23:55 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6624C195A89F; Thu, 13 Jan 2022 22:23:55 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JZf972Qdrz4jhx; Thu, 13 Jan 2022 22:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642112635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sHVEr0Yxl3T+b+k/axcBCtszMjTERhhf9Rsdl4ScQRg=; b=BU6WOaw7mE+oYd8DVI+1gTV9HVsX3KMx8srjJ4XkYNoKnM1aGS7t1y+6IYFYH78CLVzMjm t2GXZ4YMK757+NnARZY94na8xO0ZJfQnnalirSC1ZQDIlRcAOoLM0gwEks4uNNsqYEXIi/ wsXPVtoUxUkcjdhZd9ky8ovUvNQxfHJJ+AJEyZD8hNKJIlWtlxlh8TM+USrs5WAPMumble BFFlKEBLvnYLsrrlzgpWgWKT7+VXQeFUGHwbD7Te63NuvEKtcaWCsIlTYWVf8ZsvCn3gzp 0Xc6S7bJNa+RkB9+0vzw2IhKLIJGdlFrcJd7SUOc2eY+BM/HzUtL1m88qdLGGw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 328DB721; Thu, 13 Jan 2022 22:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20DMNtUC010589; Thu, 13 Jan 2022 22:23:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20DMNtUZ010588; Thu, 13 Jan 2022 22:23:55 GMT (envelope-from git) Date: Thu, 13 Jan 2022 22:23:55 GMT Message-Id: <202201132223.20DMNtUZ010588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 272e4f538467 - main - cam: Fix wiring fence post error List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 272e4f538467f41eebf611cf7ce92c5c80afcbff Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642112635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sHVEr0Yxl3T+b+k/axcBCtszMjTERhhf9Rsdl4ScQRg=; b=XPgtgxk6SAlZSIWcBJiHY61M8pfdfV8wvFT6sEjFHkl044BwdKxMoHOElLCz5Yk7ViFSX4 ExBZPzPBIyxfim78Ot3f1ffQWQzaOUPACC5aB7BkPziUUPD84UDCLctfLvIiSbtQ9FIqhW bVzbtK3qSKSEQ5yb4O0QEoGWRtkKZjVVgE+OFZ0wbO9xW5go55cVR28PBClLu7q2w6ypn3 b1DQN4cTrNnb3vqst5CuOPxWwIptMpe9D+Jl+7mLANiVzsAGfj7VF04o5TGaa/w4gNOS22 2ikq42T0hssa6NVD6bO7UxoVycgFETxEqXzvmZLiO0L4TmNTsvDMbqiLwIAHvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642112635; a=rsa-sha256; cv=none; b=HY+LNkrvaYrzcr9KgyTtPhnBRtfwf/qvTYBSYWWSwgJalK19R771qRy+0OUOmWt+PLGpqK JtmZkezJeb46SOV+1ACYMoAJH7hY3nSW4qUz7jPs5ITLWqfJg4WUCf8h7zlI4WVp4lZKnz vUYE8fNt2jADQUu9zaCy0QSAl1oHpa2TNBez4b7oc7wX9UkOIXl2cKM7Pwdqnv+OHyuioG trkSKxoxYUz0qglEDlGaKE8B9Zm8q/Nq9jVkecQ6Akap2FBENtzTAU/2Y5q7Ld+CNlg0Es TStXNUiLPHfIjszTd6Xk7UCGeCZkFyDoIwG5ehmtnDBHzf7AblZHcjBmJ5X9kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=272e4f538467f41eebf611cf7ce92c5c80afcbff commit 272e4f538467f41eebf611cf7ce92c5c80afcbff Author: Warner Losh AuthorDate: 2022-01-13 22:22:13 +0000 Commit: Warner Losh CommitDate: 2022-01-13 22:22:56 +0000 cam: Fix wiring fence post error If the last matching device entry partially matched in camperiphunit, but then hit a continue case, we'd mistakenly think we had a match on that entry. This lead to a number of problems downstream (usually a belief that we had a duplicate wiring hint because unit = 0 is the default). Fix this by using a for loop that does the assignment before the loop termination test. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D33873 --- sys/cam/cam_periph.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 1203ac2d9b21..869691f59a72 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -611,8 +611,9 @@ camperiphunit(struct periph_driver *p_drv, path_id_t pathid, unit = 0; i = 0; dname = periph_name; - while (resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0) { - wired = false; + + for (wired = false; resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0; + wired = false) { if (resource_string_value(dname, dunit, "at", &strval) == 0) { if (strcmp(strval, pathbuf) != 0) continue;