All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Opaniuk <igor.opaniuk@gmail.com>
To: mwleeds@mailtundra.com
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH 1/5] zfs: Fix malloc() success check
Date: Sun, 7 Apr 2024 13:22:03 +0200	[thread overview]
Message-ID: <CAByghJb7nkhZqeGqJxbs9DujSJP02tvCmD20zor8U5KhwD9PMg@mail.gmail.com> (raw)
In-Reply-To: <20240407014743.13872-2-mwleeds@mailtundra.com>

Hi Phaedrus,

On Sun, Apr 7, 2024 at 4:00 AM <mwleeds@mailtundra.com> wrote:

> This code was hitting the error code path whenever malloc() succeeded
> rather than when it failed, so presumably this part of the code hasn't
> been tested. I had to apply this fix (and others) to get U-Boot to boot
> from ZFS on an Nvidia Jetson TX2 NX SoM (an aarch64 computer).
>
> Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
> Tested-by: Phaedrus Leeds <mwleeds@mailtundra.com>
>
It's an abuse of the Tested-by tag. If you are the author of the patch,
that obviously implies that you tested it before sending to ML.
Signed-off-by is enough in this case.

---
>  fs/zfs/zfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c
> index 1fec96cd5c..14779dee32 100644
> --- a/fs/zfs/zfs.c
> +++ b/fs/zfs/zfs.c
> @@ -648,21 +648,21 @@ dmu_read(dnode_end_t *dn, uint64_t blkid, void **buf,
>                 if (bp_array != dn->dn.dn_blkptr) {
>                         free(bp_array);
>                         bp_array = 0;
>                 }
>
>                 if (BP_IS_HOLE(bp)) {
>                         size_t size = zfs_to_cpu16(dn->dn.dn_datablkszsec,
>
>               dn->endian)
>                                 << SPA_MINBLOCKSHIFT;
>                         *buf = malloc(size);
> -                       if (*buf) {
> +                       if (!*buf) {
>                                 err = ZFS_ERR_OUT_OF_MEMORY;
>                                 break;
>                         }
>                         memset(*buf, 0, size);
>                         endian = (zfs_to_cpu64(bp->blk_prop, endian) >>
> 63) & 1;
>                         break;
>                 }
>                 if (level == 0) {
>                         err = zio_read(bp, endian, buf, 0, data);
>                         endian = (zfs_to_cpu64(bp->blk_prop, endian) >>
> 63) & 1;
> --
> 2.44.0
>
>

-- 
Best regards - Atentamente - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk@gmail.com
skype: igor.opanyuk
https://www.linkedin.com/in/iopaniuk <http://ua.linkedin.com/in/iopaniuk>

  reply	other threads:[~2024-04-07 11:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-07  1:47 [PATCH 0/5] zfs: Fix zfs support on aarch64 mwleeds
2024-04-07  1:47 ` [PATCH 1/5] zfs: Fix malloc() success check mwleeds
2024-04-07 11:22   ` Igor Opaniuk [this message]
2024-04-12 15:54     ` mwleeds
2024-04-07  1:47 ` [PATCH 2/5] zfs: Add a comment to clarify nvlist memory layout mwleeds
2024-04-07  1:47 ` [PATCH 3/5] zfs: Fix unaligned read of uint64 mwleeds
2024-04-12 18:50   ` Caleb Connolly
2024-04-12 18:57     ` Caleb Connolly
2024-04-25  4:02     ` mwleeds
2024-04-25 11:57       ` Caleb Connolly
2024-05-08 14:54         ` Phaedrus Leeds
2024-05-08 20:04         ` mwleeds
2024-04-07  1:47 ` [PATCH 4/5] zfs: Fix return value of fs_devread() mwleeds
2024-04-07  1:47 ` [PATCH 5/5] zfs: Fix zfs_read() to actually work mwleeds
2024-04-17 19:15 ` [PATCH 0/5] zfs: Fix zfs support on aarch64 Tom Rini

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=CAByghJb7nkhZqeGqJxbs9DujSJP02tvCmD20zor8U5KhwD9PMg@mail.gmail.com \
    --to=igor.opaniuk@gmail.com \
    --cc=mwleeds@mailtundra.com \
    --cc=u-boot@lists.denx.de \
    /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.