* [PATCH] Minor coverity defect fix - CID 1125928 In set_file_xattrs: Dereference of an explicit null value
@ 2016-11-16 1:07 Harinath Nampally
2016-11-30 15:21 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Harinath Nampally @ 2016-11-16 1:07 UTC (permalink / raw)
To: linux-btrfs
---
cmds-restore.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cmds-restore.c b/cmds-restore.c
index a8c67a5..6c2ea8a 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Minor coverity defect fix - CID 1125928 In set_file_xattrs: Dereference of an explicit null value
2016-11-16 1:07 [PATCH] Minor coverity defect fix - CID 1125928 In set_file_xattrs: Dereference of an explicit null value Harinath Nampally
@ 2016-11-30 15:21 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2016-11-30 15:21 UTC (permalink / raw)
To: Harinath Nampally; +Cc: linux-btrfs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-30 15:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-16 1:07 [PATCH] Minor coverity defect fix - CID 1125928 In set_file_xattrs: Dereference of an explicit null value Harinath Nampally
2016-11-30 15:21 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).