linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-mediatek@lists.infradead.org>,
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 1/2] usb: mtu3: fix memory corruption in mtu3_debugfs_regset()
Date: Tue, 8 Dec 2020 12:14:56 +0800	[thread overview]
Message-ID: <1607400896.23328.7.camel@mhfsdcap03> (raw)
In-Reply-To: <X8ikqc4Mo2/0G72j@mwanda>

On Thu, 2020-12-03 at 11:41 +0300, Dan Carpenter wrote:
> This code is using the wrong sizeof() so it does not allocate enough
> memory.  It allocates 32 bytes but 72 are required.  That will lead to
> memory corruption.
> 
> Fixes: ae07809255d3 ("usb: mtu3: add debugfs interface files")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/usb/mtu3/mtu3_debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
> index fdeade6254ae..7537bfd651af 100644
> --- a/drivers/usb/mtu3/mtu3_debugfs.c
> +++ b/drivers/usb/mtu3/mtu3_debugfs.c
> @@ -127,7 +127,7 @@ static void mtu3_debugfs_regset(struct mtu3 *mtu, void __iomem *base,
>  	struct debugfs_regset32 *regset;
>  	struct mtu3_regset *mregs;
>  
> -	mregs = devm_kzalloc(mtu->dev, sizeof(*regset), GFP_KERNEL);
> +	mregs = devm_kzalloc(mtu->dev, sizeof(*mregs), GFP_KERNEL);
>  	if (!mregs)
>  		return;
>  Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Thanks



      reply	other threads:[~2020-12-08  4:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03  8:41 [PATCH 1/2] usb: mtu3: fix memory corruption in mtu3_debugfs_regset() Dan Carpenter
2020-12-08  4:14 ` Chunfeng Yun [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=1607400896.23328.7.camel@mhfsdcap03 \
    --to=chunfeng.yun@mediatek.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    /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).