mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 14:12:33 +00:00
scst: Let vfree handle absent verification and copy buffers
Coccinelle free/ifnullfree.cocci reports: scst/src/scst_lib.c:15441:2-7: WARNING: NULL check before some freeing functions is not needed. Remove the redundant guard around vfree(buf) in scst_copy_file and the same guard around vfree(mem_verify) in vdev_verify. Both pointers may be NULL on cleanup paths, which vfree accepts throughout the supported kernel range. Leave the NULL guards in backport.h intact: they protect older teardown APIs whose NULL handling differs, rather than these vfree calls.
This commit is contained in:
@@ -2929,8 +2929,7 @@ static enum compl_status_e vdev_verify(struct scst_cmd *cmd, loff_t loff)
|
||||
}
|
||||
|
||||
out_free:
|
||||
if (mem_verify)
|
||||
vfree(mem_verify);
|
||||
vfree(mem_verify);
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
|
||||
+1
-2
@@ -15439,8 +15439,7 @@ out_close:
|
||||
filp_close(file_src, NULL);
|
||||
|
||||
out_free:
|
||||
if (buf != NULL)
|
||||
vfree(buf);
|
||||
vfree(buf);
|
||||
|
||||
out:
|
||||
TRACE_EXIT_RES(res);
|
||||
|
||||
Reference in New Issue
Block a user