All of lore.kernel.org
 help / color / mirror / Atom feed
From: jeffy <jeffy.chen@rock-chips.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] irq/generic-chip: Fix memory leak of domain->name
Date: Thu, 28 Sep 2017 11:18:46 +0800	[thread overview]
Message-ID: <59CC6A16.9030201@rock-chips.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1709271521060.2027@nanos>

Hi Thomas,

Thanks for your review.

On 09/27/2017 09:29 PM, Thomas Gleixner wrote:
> On Wed, 27 Sep 2017, Jeffy Chen wrote:
>
>> Free domain->name when IRQ_DOMAIN_NAME_ALLOCATED been set.
>
> I can see that from the patch, but you fail to explain what the problem
> is.
>
> It's actually more than just a memory leak. If the domain gets destroyed
> then the domain free code would try to free d->name which might be a string
> constant .....
ok, i'll add that to commit msg.
>
>> +	if (d->flags & IRQ_DOMAIN_NAME_ALLOCATED) {
>> +		kfree(d->name);
>> +		d->flags &= ~IRQ_DOMAIN_NAME_ALLOCATED;
>> +	}
>>   	d->name = name;
>
> I don't think that this is the proper thing to do. There is no reason why
> the domain should have the same name as the irq chip. So we rather should
> do:
>
> 	if (!d->name)
> 		d->name = name;
>
> Along with a proper comment.
that is better, will do it in next version :)
>
> Thanks,
>
> 	tglx
>
>
>
>

  reply	other threads:[~2017-09-28  3:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 12:28 [PATCH] irq/generic-chip: Fix memory leak of domain->name Jeffy Chen
2017-09-27 13:29 ` Thomas Gleixner
2017-09-28  3:18   ` jeffy [this message]
2017-09-28  4:36     ` jeffy

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=59CC6A16.9030201@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.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.