Re: [PATCH v5 14/20] ksmbd: add ksmbd_smb2_cur_pdu_buflen()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2021-10-01 21:04 GMT+09:00, Ralph Boehme <slow@xxxxxxxxx>:
> Cc: Namjae Jeon <linkinjeon@xxxxxxxxxx>
> Cc: Tom Talpey <tom@xxxxxxxxxx>
> Cc: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
> Cc: Steve French <smfrench@xxxxxxxxx>
> Cc: Hyunchul Lee <hyc.lee@xxxxxxxxx>
> Signed-off-by: Ralph Boehme <slow@xxxxxxxxx>
> ---
>  fs/ksmbd/smb2misc.c | 25 +++++++++++++++++++++++++
>  fs/ksmbd/smb2pdu.h  |  1 +
>  2 files changed, 26 insertions(+)
>
> diff --git a/fs/ksmbd/smb2misc.c b/fs/ksmbd/smb2misc.c
> index 2cc031c39514..76f53db7db8d 100644
> --- a/fs/ksmbd/smb2misc.c
> +++ b/fs/ksmbd/smb2misc.c
> @@ -427,3 +427,28 @@ int smb2_negotiate_request(struct ksmbd_work *work)
>  {
>  	return ksmbd_smb_negotiate_common(work, SMB2_NEGOTIATE_HE);
>  }
> +
> +/**
> + * ksmbd_smb2_cur_pdu_buflen() - Get len of current SMB2 PDU buffer
> + * This returns the lenght including any possible padding.
> + * @work: smb work containing request buffer
> + */
> +unsigned int ksmbd_smb2_cur_pdu_buflen(struct ksmbd_work *work)
> +{
This patch will cause unused function build warning. so need to
combine it with "ksmbd: use ksmbd_smb2_cur_pdu_buflen() in
ksmbd_smb2_check_message() "

Thanks!
> +	struct smb2_hdr *hdr = ksmbd_req_buf_next(work);
> +	unsigned int buf_len;
> +	unsigned int pdu_len;
> +
> +	if (hdr->NextCommand != 0) {
> +		/*
> +		 * hdr->NextCommand has already been validated by
> +		 * init_chained_smb2_rsp().
> +		 */
> +		return __le32_to_cpu(hdr->NextCommand);
> +	}
> +
> +	buf_len = get_rfc1002_len(work->request_buf);
> +	pdu_len = buf_len - work->next_smb2_rcv_hdr_off;
> +	return pdu_len;
> +}
> +
> diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h
> index a6dec5ec6a54..c5fa8256b0bb 100644
> --- a/fs/ksmbd/smb2pdu.h
> +++ b/fs/ksmbd/smb2pdu.h
> @@ -1680,6 +1680,7 @@ int smb2_set_rsp_credits(struct ksmbd_work *work);
>
>  /* smb2 misc functions */
>  int ksmbd_smb2_check_message(struct ksmbd_work *work);
> +unsigned int ksmbd_smb2_cur_pdu_buflen(struct ksmbd_work *work);
>
>  /* smb2 command handlers */
>  int smb2_handle_negotiate(struct ksmbd_work *work);
> --
> 2.31.1
>
>




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux