lkml.org 
[lkml]   [2020]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 18/19] ext4: Add example fsinfo information [ver #16]
Date
Darrick J. Wong <darrick.wong@oracle.com> wrote:

> > + memcpy(ctx->buffer, es->s_volume_name, sizeof(es->s_volume_name));
>
> Shouldn't this be checking that ctx->buffer is large enough to hold
> s_volume_name?

Well, the buffer is guaranteed to be 4KiB in size.

> > + return strlen(ctx->buffer);
>
> s_volume_name is /not/ a null-terminated string if the label is 16
> characters long.

And the buffer is precleared, so it's automatically NULL terminated.

> > +#define FSINFO_ATTR_EXT4_TIMESTAMPS 0x400 /* Ext4 superblock timestamps */
>
> I guess each filesystem gets ... 256 different attrs, and the third
> nibble determines the namespace?

No. Think of it as allocating namespace in 256-number blocks. That means
there are 16 million of them. If a filesystem uses up an entire block, it can
always allocate another one. I don't think it likely that we'll get
sufficient filesystems to eat them all.

David

\
 
 \ /
  Last update: 2020-02-21 15:43    [W:0.402 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site