From: Christoph Hellwig <hch@infradead.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: joro@8bytes.org, David Laight <David.Laight@ACULAB.COM>,
iommu@lists.linux-foundation.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iommu: Fix offsetof() usage
Date: Tue, 9 Apr 2019 03:00:26 -0700 [thread overview]
Message-ID: <20190409100025.GA22084@infradead.org> (raw)
In-Reply-To: <85778a4619eab832eb0b003a68f377aea9d97b22.1554727307.git.robin.murphy@arm.com>
> index 74e944bd4a8d..81d449451494 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1484,8 +1484,7 @@ static int arm_smmu_add_device(struct device *dev)
> }
>
> ret = -ENOMEM;
> - cfg = kzalloc(offsetof(struct arm_smmu_master_cfg, smendx[i]),
> - GFP_KERNEL);
> + cfg = kzalloc(struct_size(cfg, smendx, i), GFP_KERNEL);
This looks like a huge improvement, but I find the usage of i
here still very obsfucating. Can we please use fwspec->num_ids
directly instead of make it much more obvious?
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-04-09 10:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 12:41 [PATCH] iommu: Fix offsetof() usage Robin Murphy
2019-04-09 10:00 ` Christoph Hellwig [this message]
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=20190409100025.GA22084@infradead.org \
--to=hch@infradead.org \
--cc=David.Laight@ACULAB.COM \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=robin.murphy@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).