All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Kenny <darren.kenny@oracle.com>
To: Jagannathan Raman <jag.raman@oracle.com>, grub-devel@gnu.org
Cc: daniel.kiper@oracle.com
Subject: Re: [PATCH] fill_fs_info: pass pointer to dnode_end_t instead of value
Date: Fri, 19 Aug 2022 16:09:34 +0100	[thread overview]
Message-ID: <m2h728w9qp.fsf@oracle.com> (raw)
In-Reply-To: <20220819145722.31111-1-jag.raman@oracle.com>

Hi Jag,

These changes look good to me.

Just to confirm, you have run 'make check' and this has no negative
impact on the zfs tests?

Assuming that is the case...

On Friday, 2022-08-19 at 10:57:22 -04, Jagannathan Raman wrote:
> Coverity reports that dnode_end_t argument of fill_fs_info() is too
> large to pass-by-value. Therefore, replace the argument with a pointer.
>
> Fixes: CID 73631
>
> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
>

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

Thanks,

Darren.

> ---
>  grub-core/fs/zfs/zfs.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
> index ffa0e5863..975c67242 100644
> --- a/grub-core/fs/zfs/zfs.c
> +++ b/grub-core/fs/zfs/zfs.c
> @@ -3983,14 +3983,23 @@ grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
>    return err;
>  }
>  
> +/*
> + * Note: fill_fs_info() uses functions such as make_mdn() that modify
> + * the input dnode_end_t parameter. However, we should not allow it.
> + * Therefore, we are making mdn_in constant - fill_fs_info() makes a
> + * local copy of it.
> + */
>  static grub_err_t
>  fill_fs_info (struct grub_dirhook_info *info,
> -	      dnode_end_t mdn, struct grub_zfs_data *data)
> +	      const dnode_end_t *mdn_in, struct grub_zfs_data *data)
>  {
>    grub_err_t err;
>    dnode_end_t dn;
>    grub_uint64_t objnum;
>    grub_uint64_t headobj;
> +  dnode_end_t mdn;
> +
> +  grub_memcpy (&mdn, mdn_in, sizeof (*mdn_in));
>  
>    grub_memset (info, 0, sizeof (*info));
>  
> @@ -4148,7 +4157,7 @@ iterate_zap_fs (const char *name, grub_uint64_t val,
>    if (mdn.dn.dn_type != DMU_OT_DSL_DIR)
>      return 0;
>  
> -  err = fill_fs_info (&info, mdn, ctx->data);
> +  err = fill_fs_info (&info, &mdn, ctx->data);
>    if (err)
>      {
>        grub_errno = 0;
> @@ -4179,7 +4188,7 @@ iterate_zap_snap (const char *name, grub_uint64_t val,
>    if (mdn.dn.dn_type != DMU_OT_DSL_DATASET)
>      return 0;
>  
> -  err = fill_fs_info (&info, mdn, ctx->data);
> +  err = fill_fs_info (&info, &mdn, ctx->data);
>    if (err)
>      {
>        grub_errno = 0;
> @@ -4224,7 +4233,7 @@ grub_zfs_dir (grub_device_t device, const char *path,
>        dnode_end_t dn;
>        struct grub_dirhook_info info;
>  
> -      err = fill_fs_info (&info, data->dnode, data);
> +      err = fill_fs_info (&info, &data->dnode, data);
>        if (err)
>  	{
>  	  zfs_unmount (data);
> -- 
> 2.20.1


  reply	other threads:[~2022-08-19 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 14:57 [PATCH] fill_fs_info: pass pointer to dnode_end_t instead of value Jagannathan Raman
2022-08-19 15:09 ` Darren Kenny [this message]
2022-08-19 15:11   ` Jag Raman
2022-08-19 16:42     ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2h728w9qp.fsf@oracle.com \
    --to=darren.kenny@oracle.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=jag.raman@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.