On 2019/4/19 10:14, Damien Le Moal wrote:
> On 2019/04/19 11:05, Chao Yu wrote:
>> Hi Shinichiro,
>>
>> On 2019/4/19 9:18, Shinichiro Kawasaki wrote:
>>>
>>> I don't think so. The major scenario that read_file() returns NULL is fopen 
>>> fails to read /sys/dev/block/%s/partition. It indicates that the target 
>>> device 
>>> is not a partition device. The sys_path and following code is still valid 
>>> for 
>>> the non-partition device.
>>
>> I guess you mean the case that ../partition is not existed, right? so we 
>> should
>> check errno to confirm that?
>>
>>>
>>> The other minor read_file() NULL return scenario is strdup() failure 
>>> because of 
>>> memory shortage. Do you think f2fs-tools need strdup() return value check? 
>>> If 
>>> you suggest it, I will update the patch.
>>
>> Yes, I think we need to handle that as well.
> 
> Chao,

Hi Damien,

> 
> I talked with Shinichiro. The original code is in fact mostly OK, modulo a
> change to get the correct path to the "zoned" sysfs attribute file for 
> partition
> block devices. There is also one thing missing in the original patch, namely a
> check for ENOENT error on fopen(). With these 2 changes, every error case will
> be correctly covered.
> 
> Shinichiro v2 patch will introduce these 2 fixes.

Thanks for your explanation, will check v2 later once it is sent out. :)

Thanks,

> 
> Best regards.
> 


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to