Minor coverity defect fix - CID 1125928 In set_file_xattrs: Dereference of an explicit null value
PATCH 1/1 Minor coverity defect fix - CID 1125928 In set_file_xattrs: Dereference of an explicit null value
--- cmds-restore.c | 3 +++ 1 file changed, 3 insertions(+)
cmds-restore.c +3 -0
@@ -509,6 +509,9 @@ static int set_file_xattrs(struct btrfs_root *root, u64 inode,while (cur < total_len) { len =btrfs_dir_name_len (leaf, di); +if (len ==0 ) { + goto out; + }if (len > name_len) {free (name); name = (char *)malloc (len +1 );
Signature · 1 line
2.7.4
Hi,
this patch lacks basic formatting requirements, this has been
extensively documented eg. here https://btrfs.wiki.kernel.org/index.php/Developer's_FAQ .
Besides the formalities, I'm missing what's the change rationale. It deals with a strange case when the xattr name length is 0, which is unexpected and should not be handled silently. Next I'm not sure if bailing out of the function is right, there are more items to process. Best if we could skip the damaged ones but still continue.