Re: [PATCH v9 3/7] sign-file: move file signing logic to its own function

From: Greg KH
Date: Thu Aug 10 2023 - 01:50:23 EST


On Wed, Aug 09, 2023 at 10:52:06PM +0530, Shreenidhi Shedi wrote:
> Keep the main function bare minimal and do less in main function.

"do less" means exactly what?

> This patch is pre-work for bulk module signing support.
>
> Signed-off-by: Shreenidhi Shedi <yesshedi@xxxxxxxxx>
> ---
> scripts/sign-file.c | 115 +++++++++++++++++++++-----------------------
> 1 file changed, 54 insertions(+), 61 deletions(-)
>
> diff --git a/scripts/sign-file.c b/scripts/sign-file.c
> index b0f340ea629b..64d5e00f08e2 100644
> --- a/scripts/sign-file.c
> +++ b/scripts/sign-file.c
> @@ -313,10 +313,10 @@ static void parse_args(int argc, char **argv, struct cmd_opts *opts)
> } while (opt != -1);
> }
>
> -int main(int argc, char **argv)
> +static int sign_single_file(struct cmd_opts *opts)
> {
> struct module_signature sig_info = { .id_type = PKEY_ID_PKCS7 };
> - unsigned char buf[4096];
> + unsigned char buf[4096] = {};

Why make this change? What requires it to now be zero initialized?

thanks,

greg k-h