From: Namjae Jeon <linkinjeon@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-cifs@vger.kernel.org
Subject: Re: [PATCH 3/4] ksmbd: add validation for ndr read/write functions
Date: Wed, 1 Sep 2021 21:28:47 +0900 [thread overview]
Message-ID: <CAKYAXd_mJqT1j2YiO4_kiKKMU6Wz2tLbyqUaMt99y+nBe1-Yag@mail.gmail.com> (raw)
In-Reply-To: <20210901102240.GA2129@kadam>
2021-09-01 19:22 GMT+09:00, Dan Carpenter <dan.carpenter@oracle.com>:
> On Wed, Sep 01, 2021 at 09:45:36AM +0900, Namjae Jeon wrote:
>> int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
>> {
>> - char *hex_attr;
>> - int version2;
>> -
>> - hex_attr = kzalloc(n->length, GFP_KERNEL);
>> - if (!hex_attr)
>> - return -ENOMEM;
>> + char hex_attr[12];
>> + unsigned int version2, ret;
>
> "ret" should be int. It doesn't affect runtime but for correctness it
> should be int.
Ah, Right, I will fix it on v2.
Thanks for your review!
>
>>
>> n->offset = 0;
>> - ndr_read_string(n, hex_attr, n->length);
>> - kfree(hex_attr);
>> - da->version = ndr_read_int16(n);
>> + ret = ndr_read_string(n, hex_attr, sizeof(hex_attr));
>> + if (ret)
>> + return ret;
>
> regards,
> dan carpenter
>
>
next prev parent reply other threads:[~2021-09-01 12:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 0:45 [PATCH 1/4] ksmbd: Reduce error log 'speed is unknown' to debug Namjae Jeon
2021-09-01 0:45 ` [PATCH 2/4] ksmbd: smbd: fix dma mapping error in smb_direct_post_send_data Namjae Jeon
2021-09-01 0:45 ` [PATCH 3/4] ksmbd: add validation for ndr read/write functions Namjae Jeon
2021-09-01 10:22 ` Dan Carpenter
2021-09-01 12:28 ` Namjae Jeon [this message]
2021-09-01 0:45 ` [PATCH 4/4] ksmbd: remove unused ksmbd_file_table_flush function Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKYAXd_mJqT1j2YiO4_kiKKMU6Wz2tLbyqUaMt99y+nBe1-Yag@mail.gmail.com \
--to=linkinjeon@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=linux-cifs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).