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:
Gleb Chesnokov
2026-10-20 18:02:29 +03:00
parent 4b6627b4ca
commit aab41ff5a7
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -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
View File
@@ -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);