From nobody Sun Dec 14 23:10:10 2025 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3201924A7C4 for ; Wed, 15 Jan 2025 15:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736956573; cv=none; b=XuIfTtQ7WgyCk0+risF81Cx9SHP9JpAqbw12rnip90/8/+6Td7Sfe7aERsL5EfuI6uKYpkLTPoLqxi5dpb0LkRRlt/yic89zkFLSW29t/O/fAFvd0nP72tq4zwNqSvv9jiW97pfWl5HkfHwdZdLmgv7VYh6MdGXM6RX5cqhaX1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736956573; c=relaxed/simple; bh=1+BQXZskh1lnUmnXBwA6ZKIsaGBPCvYlXMGl1mtRV9I=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JlIsWzu6ADGMM8o16xZtNP+/5beShP8nXf7eyXI5qOJgejaYisSbK73nzp2m4qLSfR0VzoDu9D4XRbcQrP9fYyVYq9YpXCcDWn+MOb2O2oDxGrygNuQz2in2XZYuDprXGDdTwZDSYrducdecNrZ3iHljDcyJycsN0xHiZw0WL4Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jx1C7duu; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jx1C7duu" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1736956568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=iDlX5Gzy2AKY576SbA7XW5gmU33x7DeFH9ESiKU19Z8=; b=jx1C7duu+SX06oV1lZXUafdrmdn7AUmOZUN73ehbLYGFwgIGTpRgDGhLTGZXq5bPz4/xdS cjwwJNH1tf/EhtdZ3+PyEcBWA00jIXCCs/L2+BRVgx9NH9qEGiLpRLkta4qU/s4OxXE9oL /+CdNXu1OY2cKv4QKjYUoqL47BLv1Eg= From: Thorsten Blum To: Alexander Potapenko , Marco Elver , Dmitry Vyukov , Andrew Morton Cc: Thorsten Blum , Anshuman Khandual , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] mm/kfence: Use str_write_read() helper in get_access_type() Date: Wed, 15 Jan 2025 16:55:12 +0100 Message-ID: <20250115155511.954535-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Remove hard-coded strings by using the str_write_read() helper function. Suggested-by: Anshuman Khandual Signed-off-by: Thorsten Blum Reviewed-by: Marco Elver --- Changes in v2: - Use str_write_read() in report.c as suggested by Marco Elver (thanks!) - Link to v1: https://lore.kernel.org/r/20250115090303.918192-2-thorsten.bl= um@linux.dev/ --- mm/kfence/kfence_test.c | 3 ++- mm/kfence/report.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c index f65fb182466d..00034e37bc9f 100644 --- a/mm/kfence/kfence_test.c +++ b/mm/kfence/kfence_test.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include =20 @@ -88,7 +89,7 @@ struct expect_report { =20 static const char *get_access_type(const struct expect_report *r) { - return r->is_write ? "write" : "read"; + return str_write_read(r->is_write); } =20 /* Check observed report matches information in @r. */ diff --git a/mm/kfence/report.c b/mm/kfence/report.c index 6370c5207d1a..10e6802a2edf 100644 --- a/mm/kfence/report.c +++ b/mm/kfence/report.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include =20 @@ -184,7 +185,7 @@ static void print_diff_canary(unsigned long address, si= ze_t bytes_to_show, =20 static const char *get_access_type(bool is_write) { - return is_write ? "write" : "read"; + return str_write_read(is_write); } =20 void kfence_report_error(unsigned long address, bool is_write, struct pt_r= egs *regs, --=20 2.47.1