* [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
[not found] <CGME20251226042825epcms2p6f02ba12fa97ff4a69c00f6fb9ff55603@epcms2p6>
@ 2025-12-26 4:28 ` Keoseong Park
2026-01-13 7:24 ` Peter Wang (王信友)
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Keoseong Park @ 2025-12-26 4:28 UTC (permalink / raw)
To: ALIM AKHTAR, avri.altman@wdc.com, bvanassche@acm.org,
James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com,
peter.wang@mediatek.com, tanghuan@vivo.com, Keoseong Park,
zhongqiu.han@oss.qualcomm.com, quic_nguyenb@quicinc.com,
liu.song13@zte.com.cn, chullee@google.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
2025-12-26 4:28 ` [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize Keoseong Park
@ 2026-01-13 7:24 ` Peter Wang (王信友)
2026-01-13 16:42 ` Bart Van Assche
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Peter Wang (王信友) @ 2026-01-13 7:24 UTC (permalink / raw)
To: avri.altman@wdc.com, liu.song13@zte.com.cn, tanghuan@vivo.com,
quic_nguyenb@quicinc.com, zhongqiu.han@oss.qualcomm.com,
bvanassche@acm.org, alim.akhtar@samsung.com,
keosung.park@samsung.com, chullee@google.com,
martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
On Fri, 2025-12-26 at 13:28 +0900, Keoseong Park wrote:
> 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);
> }
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
2025-12-26 4:28 ` [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize Keoseong Park
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
3 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2026-01-13 16:42 UTC (permalink / raw)
To: keosung.park, ALIM AKHTAR, avri.altman@wdc.com,
James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com,
peter.wang@mediatek.com, tanghuan@vivo.com,
zhongqiu.han@oss.qualcomm.com, quic_nguyenb@quicinc.com,
liu.song13@zte.com.cn, chullee@google.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
On 12/25/25 9:28 PM, Keoseong Park wrote:
> 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.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
2025-12-26 4:28 ` [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize Keoseong Park
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
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2026-01-17 4:11 UTC (permalink / raw)
To: Keoseong Park
Cc: ALIM AKHTAR, avri.altman@wdc.com, bvanassche@acm.org,
James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com,
peter.wang@mediatek.com, tanghuan@vivo.com,
zhongqiu.han@oss.qualcomm.com, quic_nguyenb@quicinc.com,
liu.song13@zte.com.cn, chullee@google.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Keoseong,
> 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.
Applied to 6.20/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
2025-12-26 4:28 ` [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize Keoseong Park
` (2 preceding siblings ...)
2026-01-17 4:11 ` Martin K. Petersen
@ 2026-01-24 3:50 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2026-01-24 3:50 UTC (permalink / raw)
To: ALIM AKHTAR, avri.altman, bvanassche, James.Bottomley, peter.wang,
tanghuan, zhongqiu.han, quic_nguyenb, liu.song13, chullee,
Keoseong Park
Cc: Martin K . Petersen, linux-scsi, linux-kernel
On Fri, 26 Dec 2025 13:28:25 +0900, Keoseong Park wrote:
> 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.
>
>
Applied to 6.20/scsi-queue, thanks!
[1/1] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
https://git.kernel.org/mkp/scsi/c/695df7ea6099
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-24 3:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20251226042825epcms2p6f02ba12fa97ff4a69c00f6fb9ff55603@epcms2p6>
2025-12-26 4:28 ` [PATCH] scsi: ufs: core: Handle sentinel value for dHIDAvailableSize Keoseong Park
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox