Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Keoseong Park and committed by
Martin K. Petersen
695df7ea 07959ef5

+4
+4
drivers/ufs/core/ufs-sysfs.c
··· 1847 1847 1848 1848 static DEVICE_ATTR_WO(defrag_trigger); 1849 1849 1850 + #define UFS_HID_AVAILABLE_SIZE_INVALID 0xFFFFFFFFU 1850 1851 static ssize_t fragmented_size_show(struct device *dev, 1851 1852 struct device_attribute *attr, char *buf) 1852 1853 { ··· 1859 1858 QUERY_ATTR_IDN_HID_AVAILABLE_SIZE, &value); 1860 1859 if (ret) 1861 1860 return ret; 1861 + 1862 + if (value == UFS_HID_AVAILABLE_SIZE_INVALID) 1863 + return -ENODATA; 1862 1864 1863 1865 return sysfs_emit(buf, "%u\n", value); 1864 1866 }