mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keoseong Park <keosung.park@samsung.com>
To: ALIM AKHTAR <alim.akhtar@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"peter.wang@mediatek.com" <peter.wang@mediatek.com>,
	"tanghuan@vivo.com" <tanghuan@vivo.com>,
	Keoseong Park <keosung.park@samsung.com>,
	"zhongqiu.han@oss.qualcomm.com" <zhongqiu.han@oss.qualcomm.com>,
	"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
	"liu.song13@zte.com.cn" <liu.song13@zte.com.cn>,
	"chullee@google.com" <chullee@google.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
Date: Fri, 26 Dec 2025 13:28:25 +0900	[thread overview]
Message-ID: <20251226042825epcms2p6f02ba12fa97ff4a69c00f6fb9ff55603@epcms2p6> (raw)
In-Reply-To: <CGME20251226042825epcms2p6f02ba12fa97ff4a69c00f6fb9ff55603@epcms2p6>

JEDEC UFS spec defines 0xFFFFFFFF for dHIDAvailableSize as indicating no
valid fragmented size information. Returning the raw value can mislead
userspace. Return -ENODATA instead when the value is unavailable.

Signed-off-by: Keoseong Park <keosung.park@samsung.com>
---
 drivers/ufs/core/ufs-sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
index b33f8656edb5..1017dd3ae5d3 100644
--- a/drivers/ufs/core/ufs-sysfs.c
+++ b/drivers/ufs/core/ufs-sysfs.c
@@ -1847,6 +1847,7 @@ static ssize_t defrag_trigger_store(struct device *dev,
 
 static DEVICE_ATTR_WO(defrag_trigger);
 
+#define UFS_HID_AVAILABLE_SIZE_INVALID 0xFFFFFFFFU
 static ssize_t fragmented_size_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -1859,6 +1860,9 @@ static ssize_t fragmented_size_show(struct device *dev,
 	if (ret)
 		return ret;
 
+	if (value == UFS_HID_AVAILABLE_SIZE_INVALID)
+		return -ENODATA;
+
 	return sysfs_emit(buf, "%u\n", value);
 }
 
-- 
2.25.1


       reply	other threads:[~2025-12-26  4:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20251226042825epcms2p6f02ba12fa97ff4a69c00f6fb9ff55603@epcms2p6>
2025-12-26  4:28 ` Keoseong Park [this message]
2026-01-13  7:24   ` Peter Wang (王信友)
2026-01-13 16:42   ` Bart Van Assche
2026-01-17  4:11   ` Martin K. Petersen
2026-01-24  3:50   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251226042825epcms2p6f02ba12fa97ff4a69c00f6fb9ff55603@epcms2p6 \
    --to=keosung.park@samsung.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=chullee@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liu.song13@zte.com.cn \
    --cc=martin.petersen@oracle.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=tanghuan@vivo.com \
    --cc=zhongqiu.han@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®