diff mbox

[RESEND,#4] dj: memory scribble in logi_dj

Message ID 20120904140924.26323.88903.stgit@localhost.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Alan Cox Sept. 4, 2012, 2:10 p.m. UTC
I've been sending this to the input list and maintainer for a month now with
no response, so this time it goes directly to Linus.

From: Alan Cox <alan@linux.intel.com>

Allocate a structure not a pointer to it !

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/hid/hid-logitech-dj.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Benjamin Tissoires Sept. 6, 2012, 11:39 a.m. UTC | #1
Hi Alan,

Sorry for not seeing this earlier.

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>

Jiri, can this fall into upstream-fixes?

Thanks,
Benjamin

On Tue, Sep 4, 2012 at 4:10 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> I've been sending this to the input list and maintainer for a month now with
> no response, so this time it goes directly to Linus.
>
> From: Alan Cox <alan@linux.intel.com>
>
> Allocate a structure not a pointer to it !
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
>
>  drivers/hid/hid-logitech-dj.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
> index 0f9c146..4d524b5 100644
> --- a/drivers/hid/hid-logitech-dj.c
> +++ b/drivers/hid/hid-logitech-dj.c
> @@ -439,7 +439,7 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
>         struct dj_report *dj_report;
>         int retval;
>
> -       dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
> +       dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
>         if (!dj_report)
>                 return -ENOMEM;
>         dj_report->report_id = REPORT_ID_DJ_SHORT;
> @@ -456,7 +456,7 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
>         struct dj_report *dj_report;
>         int retval;
>
> -       dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
> +       dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
>         if (!dj_report)
>                 return -ENOMEM;
>         dj_report->report_id = REPORT_ID_DJ_SHORT;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Kosina Sept. 6, 2012, 11:47 a.m. UTC | #2
On Thu, 6 Sep 2012, Benjamin Tissoires wrote:

> Sorry for not seeing this earlier.
> 
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
> 
> Jiri, can this fall into upstream-fixes?

I have discussed this with Alan a few moments ago ... unfortunately none 
of the four resends has been sent directly to me (I would have expected at 
least the resent patch been sent directly to the maintainer as well), but 
just to the lists ... so it was lost between the cracks of 
lkml/linux-input.

Linus has just applied it directly today.

Thanks everybody,
diff mbox

Patch

diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 0f9c146..4d524b5 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -439,7 +439,7 @@  static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
 	struct dj_report *dj_report;
 	int retval;
 
-	dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
+	dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
 	if (!dj_report)
 		return -ENOMEM;
 	dj_report->report_id = REPORT_ID_DJ_SHORT;
@@ -456,7 +456,7 @@  static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
 	struct dj_report *dj_report;
 	int retval;
 
-	dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
+	dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
 	if (!dj_report)
 		return -ENOMEM;
 	dj_report->report_id = REPORT_ID_DJ_SHORT;