mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
scsi: ufs: core: Handle sentinel value for dHIDAvailableSize
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> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20251226042825epcms2p6f02ba12fa97ff4a69c00f6fb9ff55603@epcms2p6 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
07959ef517
commit
695df7ea60
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user