From nobody Mon Jun 06 08:32:14 2022 X-Original-To: dev-commits-src-main@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 3CCBA1BE7083; Mon, 6 Jun 2022 08:32:15 +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 4LGmv308jYz4WpG; Mon, 6 Jun 2022 08:32:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654504335; 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=mhZ6RI+Z7GY091Awh73bGLNywOVblPFXyFwHnkTN3hY=; b=qBSx/BFpk1j4hfqI9wWFL7saOFyx9ntQE6T2HPvp17Y5q4DiuXEr5aeuqzT6wPgUKHw1rg vSDun8rvIGfNpXVy2ebuSw7ksdBKFHxWcNW2olQRjj00xksP1YIAJFrhjFYBAt9CPHuop9 NTry66IDMiiWJKMIN/6gz5Yabml3pse7V3v5vpMCXTckiWnqu4WM7TfUQZ8IkuDrc+Xldz 0LKEi+kO+lgp7WqpBvw1YcaFCyHA2qCS+uZiL8Xv25HAv1cqd2cXWkYAPrf+QQw5yaknkR lINTmX/n4hYk5XEPx19Cor983+JH4ZIjxdUo/Y2Qjfl94dJnMZVayfuX+68Jig== 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 DA4FB22CA9; Mon, 6 Jun 2022 08:32:14 +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 2568WEXj097504; Mon, 6 Jun 2022 08:32:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2568WEJ5097503; Mon, 6 Jun 2022 08:32:14 GMT (envelope-from git) Date: Mon, 6 Jun 2022 08:32:14 GMT Message-Id: <202206060832.2568WEJ5097503@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 85d7875d4291 - main - LinuxKPI: Fix dmi_matches() function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 85d7875d42913c2cb10a007a1be05b210dc6aab2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654504335; 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=mhZ6RI+Z7GY091Awh73bGLNywOVblPFXyFwHnkTN3hY=; b=mVJh/VHtO4KWeYl92IE5QsmgB3JuHKOl6Ao6iP9ivJX8EIw5EX4aV+3D7m3g65etgdRWNv 5AKdYQXUE1nmQHypKnqmyezR+T+m5ut2Rq2IRelXHRX+KLKYXYHNxPXUJE2FuUHwvxrCeG iWotoc1PvLLRUtXezlasatOyud+ctronCXcaX6NketFiWacqwAgGEh1bQu/egq8VR5Toy4 fCrvcMzEMetsXdCJ1k0ouD8ek3Hq5sT5NRGLNSuapJTNW6qD3fTjBN7sG2UT1HN30Ne95o 3jwRsSJjLufwVeKp9anRml7b35+7cgI1FzfkwFXvLpMIIHVVMYHBnYBrVzSGFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654504335; a=rsa-sha256; cv=none; b=H+LYF8umsQW2hOVhHDKXtZi0z80mNTd/Zet8TNMYDuEZk/RZyo5G79nsgY7cKcnVO84iCg vjEmn71+d+8UKUWGk+fYX62ICePCoCrR8EdaFbFV8hAfHlcKtxBxwBGv4xWY9ZyGpBIJH0 kPD5BcE8XFSi7NrjMVoJVasmKJMpIJrNj/Z+h+NYF2Jlld9EVvpXI7sMtEX3uj2b9OGnfY /Y0wicCisrs5YShfHI15HAsNYll7Fj5HEI1cICok93XiP3CAAoVkBqbQOBsdXRed/R3SDj E3VP5XQhlcWFnvydcrn2W4RCMW5U++aADr98+weQvpUcKvHrhM0WHHxteg7+Uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=85d7875d42913c2cb10a007a1be05b210dc6aab2 commit 85d7875d42913c2cb10a007a1be05b210dc6aab2 Author: Hans Petter Selasky AuthorDate: 2022-06-06 08:23:23 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-06 08:31:34 +0000 LinuxKPI: Fix dmi_matches() function Make sure to check for NULL pointers and also check all search criterias, not only the first one! Bump the FreeBSD version. Reviewed by: manu@ Differential Revision: https://reviews.freebsd.org/D35403 MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/compat/linuxkpi/common/src/linux_dmi.c | 19 ++++++++++++------- sys/sys/param.h | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_dmi.c b/sys/compat/linuxkpi/common/src/linux_dmi.c index f5350751a496..70d56c246c10 100644 --- a/sys/compat/linuxkpi/common/src/linux_dmi.c +++ b/sys/compat/linuxkpi/common/src/linux_dmi.c @@ -77,20 +77,25 @@ linux_dmi_match(enum dmi_field f, const char *str) static bool linux_dmi_matches(const struct dmi_system_id *dsi) { + enum dmi_field slot; int i; for (i = 0; i < nitems(dsi->matches); i++) { - if (dsi->matches[i].slot == DMI_NONE) + slot = dsi->matches[i].slot; + if (slot == DMI_NONE) break; + if (slot >= DMI_STRING_MAX || + dmi_data[slot] == NULL) + return (false); if (dsi->matches[i].exact_match) { - return (dmi_match(dsi->matches[i].slot, - dsi->matches[i].substr)); - } else { - return (strstr(dmi_data[dsi->matches[i].slot], - dsi->matches[i].substr) != NULL); + if (dmi_match(slot, dsi->matches[i].substr)) + continue; + } else if (strstr(dmi_data[slot], + dsi->matches[i].substr) != NULL) { + continue; } + return (false); } - return (true); } diff --git a/sys/sys/param.h b/sys/sys/param.h index 1f720ed31142..d68b5c2d4f2f 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400059 +#define __FreeBSD_version 1400060 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,