lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202211222007593082125@zte.com.cn>
Date:   Tue, 22 Nov 2022 20:07:59 +0800 (CST)
From:   <yang.yang29@....com.cn>
To:     <zhenyuw@...ux.intel.com>
Cc:     <zhi.a.wang@...el.com>, <jani.nikula@...ux.intel.com>,
        <joonas.lahtinen@...ux.intel.com>, <rodrigo.vivi@...el.com>,
        <tvrtko.ursulin@...ux.intel.com>, <airlied@...il.com>,
        <daniel@...ll.ch>, <intel-gvt-dev@...ts.freedesktop.org>,
        <intel-gfx@...ts.freedesktop.org>,
        <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
        <xu.panda@....com.cn>, <yang.yang29@....com.cn>
Subject: [PATCH linux-next] drm/i915/gvt: use sysfs_streq() instead of strncmp()

From: Xu Panda <xu.panda@....com.cn>

Replace the open-code with sysfs_streq().

Signed-off-by: Xu Panda <xu.panda@....com.cn>
Signed-off-by: Yang Yang <yang.yang29@....com>
---
 drivers/gpu/drm/i915/gvt/cmd_parser.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index 0ebf5fbf0e39..7b9a5f7f5363 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
@@ -917,8 +917,8 @@ static int cmd_reg_handler(struct parser_exec_state *s,
 		return -EBADRQC;
 	}

-	if (!strncmp(cmd, "srm", 3) ||
-			!strncmp(cmd, "lrm", 3)) {
+	if (sysfs_streq(cmd, "srm") ||
+			sysfs_streq(cmd, "lrm")) {
 		if (offset == i915_mmio_reg_offset(GEN8_L3SQCREG4) ||
 		    offset == 0x21f0 ||
 		    (IS_BROADWELL(gvt->gt->i915) &&
@@ -931,8 +931,8 @@ static int cmd_reg_handler(struct parser_exec_state *s,
 		}
 	}

-	if (!strncmp(cmd, "lrr-src", 7) ||
-			!strncmp(cmd, "lrr-dst", 7)) {
+	if (sysfs_streq(cmd, "lrr-src") ||
+			sysfs_streq(cmd, "lrr-dst")) {
 		if (IS_BROADWELL(gvt->gt->i915) && offset == 0x215c)
 			return 0;
 		else {
@@ -941,12 +941,12 @@ static int cmd_reg_handler(struct parser_exec_state *s,
 		}
 	}

-	if (!strncmp(cmd, "pipe_ctrl", 9)) {
+	if (sysfs_streq(cmd, "pipe_ctrl")) {
 		/* TODO: add LRI POST logic here */
 		return 0;
 	}

-	if (strncmp(cmd, "lri", 3))
+	if (!sysfs_streq(cmd, "lri"))
 		return -EPERM;

 	/* below are all lri handlers */
@@ -1011,7 +1011,7 @@ static int cmd_reg_handler(struct parser_exec_state *s,
 	 */
 	if (GRAPHICS_VER(s->engine->i915) == 9 &&
 	    intel_gvt_mmio_is_sr_in_ctx(gvt, offset) &&
-	    !strncmp(cmd, "lri", 3)) {
+	    sysfs_streq(cmd, "lri")) {
 		intel_gvt_read_gpa(s->vgpu,
 			s->workload->ring_context_gpa + 12, &ctx_sr_ctl, 4);
 		/* check inhibit context */
-- 
2.15.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ