Message ID | 20240620191631.28811-1-ilias.apalodimas@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] tpm: Fix return code, if the eventlog buffer is full | expand |
On Thu, 20 Jun 2024 at 22:16, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote: > > We currently return 'No space left on device' if the eventlong buffer > we allocated is not enough. On a similar check later on that function > during the call to tcg2_log_init() we return 'No buffer space > available'. So switch both error codes to -ENOBUFS since we are always > checking a buffer and not a device. > > Fixes: 97707f12fdab ("tpm: Support boot measurements") and now I wonder why checkpatch didn't warn on this. There's a 'commit' missing after the Fixes tag. Sorry! > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> > --- > lib/tpm-v2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c > index a67daed2f3c1..91526af33acb 100644 > --- a/lib/tpm-v2.c > +++ b/lib/tpm-v2.c > @@ -554,7 +554,7 @@ int tcg2_log_prepare_buffer(struct udevice *dev, struct tcg2_event_log *elog, > if (elog->log_size) { > if (log.found) { > if (elog->log_size < log.log_position) > - return -ENOSPC; > + return -ENOBUFS; > > /* > * Copy the discovered log into the user buffer > -- > 2.45.2 >
On Thu, 20 Jun 2024 at 22:19, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote: > > On Thu, 20 Jun 2024 at 22:16, Ilias Apalodimas > <ilias.apalodimas@linaro.org> wrote: > > > > We currently return 'No space left on device' if the eventlong buffer > > we allocated is not enough. On a similar check later on that function > > during the call to tcg2_log_init() we return 'No buffer space > > available'. So switch both error codes to -ENOBUFS since we are always > > checking a buffer and not a device. > > > > Fixes: 97707f12fdab ("tpm: Support boot measurements") > > and now I wonder why checkpatch didn't warn on this. There's a > 'commit' missing after the Fixes tag. Sorry! > > > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> > > --- > > lib/tpm-v2.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c > > index a67daed2f3c1..91526af33acb 100644 > > --- a/lib/tpm-v2.c > > +++ b/lib/tpm-v2.c > > @@ -554,7 +554,7 @@ int tcg2_log_prepare_buffer(struct udevice *dev, struct tcg2_event_log *elog, > > if (elog->log_size) { > > if (log.found) { > > if (elog->log_size < log.log_position) > > - return -ENOSPC; > > + return -ENOBUFS; > > > > /* > > * Copy the discovered log into the user buffer > > -- > > 2.45.2 > > This is now included in https://lore.kernel.org/u-boot/20240622143601.187723-1-ilias.apalodimas@linaro.org/T/#t Cheers /Ilias
diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index a67daed2f3c1..91526af33acb 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -554,7 +554,7 @@ int tcg2_log_prepare_buffer(struct udevice *dev, struct tcg2_event_log *elog, if (elog->log_size) { if (log.found) { if (elog->log_size < log.log_position) - return -ENOSPC; + return -ENOBUFS; /* * Copy the discovered log into the user buffer
We currently return 'No space left on device' if the eventlong buffer we allocated is not enough. On a similar check later on that function during the call to tcg2_log_init() we return 'No buffer space available'. So switch both error codes to -ENOBUFS since we are always checking a buffer and not a device. Fixes: 97707f12fdab ("tpm: Support boot measurements") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> --- lib/tpm-v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)