Message ID | 20220316035100.68406-1-xiubli@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ceph: fix the buf size and use NAME_SIZE instead | expand |
On Wed, Mar 16, 2022 at 9:21 AM <xiubli@redhat.com> wrote: > > From: Xiubo Li <xiubli@redhat.com> > > Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, > no need to allocate a buffer from the stack that long. > > Signed-off-by: Xiubo Li <xiubli@redhat.com> > --- > > Jeff, you can just squash this into the previous commit. > > > fs/ceph/mds_client.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c > index c51b07ec72cf..cd0c780a6f84 100644 > --- a/fs/ceph/mds_client.c > +++ b/fs/ceph/mds_client.c > @@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for > parent = dget_parent(cur); > } else { > int len, ret; > - char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)]; > + char buf[NAME_MAX]; > > /* > * Proactively copy name into buf, in case we need to present > -- > 2.27.0 > Makes sense. Acked-by: Venky Shankar <vshankar@redhat.com>
On Wed, 2022-03-16 at 11:51 +0800, xiubli@redhat.com wrote: > From: Xiubo Li <xiubli@redhat.com> > > Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, > no need to allocate a buffer from the stack that long. > > Signed-off-by: Xiubo Li <xiubli@redhat.com> > --- > > Jeff, you can just squash this into the previous commit. > > > fs/ceph/mds_client.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c > index c51b07ec72cf..cd0c780a6f84 100644 > --- a/fs/ceph/mds_client.c > +++ b/fs/ceph/mds_client.c > @@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for > parent = dget_parent(cur); > } else { > int len, ret; > - char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)]; > + char buf[NAME_MAX]; > > /* > * Proactively copy name into buf, in case we need to present Thanks Xiubo. I folded this into: ceph: add encrypted fname handling to ceph_mdsc_build_path ...and merged in the other patches you sent earlier today. I also went ahead and squashed down the readdir patches that you sent yesterday, so that we could get rid of the interim readdir handling that I had originally written. It might need a bit more cleanup -- some of the deltas in the merged patch probably belong in earlier commits, but it should be ok for now. Please take a look and make sure I didn't miss anything there.
On 3/16/22 7:50 PM, Jeff Layton wrote: > On Wed, 2022-03-16 at 11:51 +0800, xiubli@redhat.com wrote: >> From: Xiubo Li <xiubli@redhat.com> >> >> Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, >> no need to allocate a buffer from the stack that long. >> >> Signed-off-by: Xiubo Li <xiubli@redhat.com> >> --- >> >> Jeff, you can just squash this into the previous commit. >> >> >> fs/ceph/mds_client.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c >> index c51b07ec72cf..cd0c780a6f84 100644 >> --- a/fs/ceph/mds_client.c >> +++ b/fs/ceph/mds_client.c >> @@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for >> parent = dget_parent(cur); >> } else { >> int len, ret; >> - char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)]; >> + char buf[NAME_MAX]; >> >> /* >> * Proactively copy name into buf, in case we need to present > Thanks Xiubo. I folded this into: > > ceph: add encrypted fname handling to ceph_mdsc_build_path > > ...and merged in the other patches you sent earlier today. > > I also went ahead and squashed down the readdir patches that you sent > yesterday, so that we could get rid of the interim readdir handling that > I had originally written. > > It might need a bit more cleanup -- some of the deltas in the merged > patch probably belong in earlier commits, but it should be ok for now. > > Please take a look and make sure I didn't miss anything there. Sure, will check it today. - Xiubo
On 3/16/22 7:50 PM, Jeff Layton wrote: > On Wed, 2022-03-16 at 11:51 +0800, xiubli@redhat.com wrote: >> From: Xiubo Li <xiubli@redhat.com> >> >> Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, >> no need to allocate a buffer from the stack that long. >> >> Signed-off-by: Xiubo Li <xiubli@redhat.com> >> --- >> >> Jeff, you can just squash this into the previous commit. >> >> >> fs/ceph/mds_client.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c >> index c51b07ec72cf..cd0c780a6f84 100644 >> --- a/fs/ceph/mds_client.c >> +++ b/fs/ceph/mds_client.c >> @@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for >> parent = dget_parent(cur); >> } else { >> int len, ret; >> - char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)]; >> + char buf[NAME_MAX]; >> >> /* >> * Proactively copy name into buf, in case we need to present > Thanks Xiubo. I folded this into: > > ceph: add encrypted fname handling to ceph_mdsc_build_path > > ...and merged in the other patches you sent earlier today. > > I also went ahead and squashed down the readdir patches that you sent > yesterday, so that we could get rid of the interim readdir handling that > I had originally written. > > It might need a bit more cleanup -- some of the deltas in the merged > patch probably belong in earlier commits, but it should be ok for now. > > Please take a look and make sure I didn't miss anything there. I have gone through the wip-fscrypt, all these look fine. -- Xiubo
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index c51b07ec72cf..cd0c780a6f84 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for parent = dget_parent(cur); } else { int len, ret; - char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)]; + char buf[NAME_MAX]; /* * Proactively copy name into buf, in case we need to present