[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20080212160407.2e2f64ce.akpm@linux-foundation.org>
Date: Tue, 12 Feb 2008 16:04:07 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Magnus Damm <magnus.damm@...il.com>
Cc: linux-kernel@...r.kernel.org, ben@...ff.org, magnus.damm@...il.com,
linux-sh@...r.kernel.org
Subject: Re: [PATCH] sm501: Add uart support
On Fri, 08 Feb 2008 18:57:42 +0900
Magnus Damm <magnus.damm@...il.com> wrote:
> smdev = kzalloc(sizeof(struct sm501_device) +
> - sizeof(struct resource) * res_count, GFP_KERNEL);
> + (sizeof(struct resource) * res_count) +
> + platform_data_size, GFP_KERNEL);
>
> ...
>
> + smdev->pdev.resource = (struct resource *)(smdev+1);
So this driver plays party tricks with memory allocation and the C type
system.
We could at least add
struct resource resources[0];
to the end of `struct sm501_device' to avoid the type abuse. Or we could
even get radical and splurge four bytes on a `struct resource *'. But
please, not this.
Oh well. A pre-existing problem.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists