Commit 9d9b724
xfs/libxfs: replace kmalloc() and memcpy() with kmemdup()
The source static analysis tool gave the following advice:
./fs/xfs/libxfs/xfs_dir2.c:382:15-22: WARNING opportunity for kmemdup
→ 382 args->value = kmalloc(len,
383 GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_RETRY_MAYFAIL);
384 if (!args->value)
385 return -ENOMEM;
386
→ 387 memcpy(args->value, name, len);
388 args->valuelen = len;
389 return -EEXIST;
Replacing kmalloc() + memcpy() with kmemdump() doesn't change semantics.
Original code works without fault, so this is not a bug fix but proposed improvement.
Link: https://lwn.net/Articles/198928/
Fixes: 94a69db ("xfs: use __GFP_NOLOCKDEP instead of GFP_NOFS")
Fixes: 384f3ce ("[XFS] Return case-insensitive match for dentry cache")
Fixes: 2451337 ("xfs: global error sign conversion")
Cc: Carlos Maiolino <[email protected]>
Cc: Darrick J. Wong <[email protected]>
Cc: Chandan Babu R <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Reviewed-by: "Darrick J. Wong" <[email protected]>
Signed-off-by: Mirsad Todorovac <[email protected]>
Signed-off-by: Carlos Maiolino <[email protected]>1 parent 183d988 commit 9d9b724
1 file changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
388 | 387 | | |
389 | 388 | | |
390 | 389 | | |
| |||
0 commit comments