Re: [PATCH v2 1/2] fs/kernel_read_file: Allow to read files up-to ssize_t

From: Baoquan He
Date: Tue Jun 07 2022 - 23:49:49 EST


On 06/07/22 at 11:52am, Pasha Tatashin wrote:
> On Sun, Jun 5, 2022 at 10:45 PM Baoquan He <bhe@xxxxxxxxxx> wrote:
> >
> > On 05/27/22 at 02:55am, Pasha Tatashin wrote:
> > > Currently, the maximum file size that is supported is 2G. This may be
> > > too small in some cases. For example, kexec_file_load() system call
> > > loads initramfs. In some netboot cases initramfs can be rather large.
> > >
> > > Allow to use up-to ssize_t bytes. The callers still can limit the
> > > maximum file size via buf_size.
> >
> > If we really met initramfs bigger than 2G, it's reasonable to increase
> > the limit. While wondering why we should take sszie_t, but not size_t.
>
> ssize_t instead of size_t so we can return errors as negative values.

Makes sense. Thanks.