From: Volker Lendecke Date: Sat, 13 Sep 2025 09:47:42 +0000 (+0200) Subject: smbd: Remove a few unnecessary NULL checks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97608924c15d6900d49881e18e8cd4a78ecdbf58;p=thirdparty%2Fsamba.git smbd: Remove a few unnecessary NULL checks These functions are only called from smbd_do_setfilepathinfo() which has checked with SMB_ASSERT(fsp != NULL). Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index 1d0580c0283..6f488812463 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -4084,19 +4084,6 @@ static NTSTATUS smb_info_set_ea(connection_struct *conn, return NT_STATUS_INVALID_PARAMETER; } - if (fsp == NULL) { - /* - * The only way fsp can be NULL here is if - * smb_fname points at a symlink and - * and we're in POSIX context. - * Ensure this is the case. - * - * In this case we cannot set the EA. - */ - SMB_ASSERT(smb_fname->flags & SMB_FILENAME_POSIX_PATH); - return NT_STATUS_ACCESS_DENIED; - } - status = set_ea(conn, fsp, ea_list); return status; @@ -4114,10 +4101,6 @@ static NTSTATUS smb_set_file_full_ea_info(connection_struct *conn, struct ea_list *ea_list = NULL; NTSTATUS status; - if (fsp == NULL) { - return NT_STATUS_INVALID_HANDLE; - } - if (!lp_ea_support(SNUM(conn))) { DEBUG(10, ("smb_set_file_full_ea_info - ea_len = %u but " "EA's not supported.\n", @@ -4684,7 +4667,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn, return NT_STATUS_NOT_SUPPORTED; } - if (fsp && fsp->base_fsp) { + if (fsp->base_fsp) { /* newname must be a stream name. */ if (newname[0] != ':') { return NT_STATUS_NOT_SUPPORTED; @@ -4783,7 +4766,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn, } } - if (fsp != NULL && fsp->fsp_flags.is_fsa) { + if (fsp->fsp_flags.is_fsa) { DBG_DEBUG("SMB_FILE_RENAME_INFORMATION (%s) %s -> %s\n", fsp_fnum_dbg(fsp), fsp_str_dbg(fsp), @@ -4846,10 +4829,6 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn, return NT_STATUS_INVALID_PARAMETER; } - if (fsp == NULL) { - return NT_STATUS_INVALID_HANDLE; - } - status = check_any_access_fsp(fsp, FILE_WRITE_ATTRIBUTES); if (!NT_STATUS_IS_OK(status)) { return status;