samples/seccomp: fix error return code in handle_req()
PATCH 1/1 samples/seccomp: fix error return code in handle_req()
Unlike branch "if (lseek(mem, req->data.args[0], SEEK_SET) < 0)" above, 'ret' is overwritten by the previous 'ret = read(...)' statement. Therefore, 'ret' needs to be explicitly assigned to -1 here. Otherwise, 0 is incorrectly returned.
Reported-by Hulk Robot <[email protected]>
Signed-off-by Zhen Lei <[email protected]>
--- samples/seccomp/user-trap.c | 1 + 1 file changed, 1 insertion(+)
samples/seccomp/user-trap.c +1 -0
@@ -164,6 +164,7 @@ static int handle_req(struct seccomp_notif *req, }if (lseek (mem, req->data.args[1 ],SEEK_SET ) <0 ) { + ret =-1 ;perror ("seek" ); goto out; }
Signature · 1 line
2.25.1