mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 15:03:53 +02:00
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:94a69db236
("xfs: use __GFP_NOLOCKDEP instead of GFP_NOFS") Fixes:384f3ced07
("[XFS] Return case-insensitive match for dentry cache") Fixes:2451337dd0
("xfs: global error sign conversion") Cc: Carlos Maiolino <cem@kernel.org> Cc: Darrick J. Wong <djwong@kernel.org> Cc: Chandan Babu R <chandanbabu@kernel.org> Cc: Dave Chinner <dchinner@redhat.com> Cc: linux-xfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Mirsad Todorovac <mtodorovac69@gmail.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
183d988ae9
commit
9d9b724726
|
@ -379,12 +379,11 @@ xfs_dir_cilookup_result(
|
|||
!(args->op_flags & XFS_DA_OP_CILOOKUP))
|
||||
return -EEXIST;
|
||||
|
||||
args->value = kmalloc(len,
|
||||
args->value = kmemdup(name, len,
|
||||
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_RETRY_MAYFAIL);
|
||||
if (!args->value)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(args->value, name, len);
|
||||
args->valuelen = len;
|
||||
return -EEXIST;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user