From: John Garry <john.garry@huawei.com>
To: Joe Perches <joe@perches.com>, <xuwei5@huawei.com>
Cc: <bhelgaas@google.com>, <linuxarm@huawei.com>, <arm@kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bus: hisi_lpc: Don't use devm_kzalloc() to allocate logical PIO range
Date: Fri, 14 Jun 2019 11:07:10 +0100 [thread overview]
Message-ID: <03b579d3-fa1a-57c8-a585-7b23a52b1f49@huawei.com> (raw)
In-Reply-To: <8eacbd27239ec5ce956309278beae9b499499108.camel@perches.com>
On 14/06/2019 11:04, Joe Perches wrote:
> On Fri, 2019-06-14 at 17:47 +0800, John Garry wrote:
>> If, after registering a logical PIO range, the driver probe later fails,
>> the logical PIO range memory will be released automatically.
>>
>> This causes an issue, in that the logical PIO range is not unregistered
>> (that is not supported) and the released range memory may be later
>> referenced
>>
>> Allocate the logical PIO range with kzalloc() to avoid this potential
>> issue.
>>
>> Fixes: adf38bb0b5956 ("HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings")
>> Signed-off-by: John Garry <john.garry@huawei.com>
>>
>> diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
> []
>> @@ -599,7 +599,7 @@ static int hisi_lpc_probe(struct platform_device *pdev)
>> if (IS_ERR(lpcdev->membase))
>> return PTR_ERR(lpcdev->membase);
>>
>> - range = devm_kzalloc(dev, sizeof(*range), GFP_KERNEL);
>> + range = kzalloc(sizeof(*range), GFP_KERNEL);
>
> If this is really necessary, it'd be useful to say so in the
> code too with a comment so it doesn't get drive-by 'unfixed'
> by someone well meaning but ill-uninformed.
OK, fine. I can do that.
Cheers,
John
>
>
>
> .
>
prev parent reply other threads:[~2019-06-14 10:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 9:47 John Garry
2019-06-14 10:04 ` Joe Perches
2019-06-14 10:07 ` John Garry [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=03b579d3-fa1a-57c8-a585-7b23a52b1f49@huawei.com \
--to=john.garry@huawei.com \
--cc=arm@kernel.org \
--cc=bhelgaas@google.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=xuwei5@huawei.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
all inboxes | Powered by JetHome®