LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-kernel@vger.kernel.org, ben@fluff.org,
	magnus.damm@gmail.com, linux-sh@vger.kernel.org
Subject: Re: [PATCH] sm501: Add uart support
Date: Tue, 12 Feb 2008 16:04:07 -0800	[thread overview]
Message-ID: <20080212160407.2e2f64ce.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080208095742.2041.46016.sendpatchset@clockwork.opensource.se>

On Fri, 08 Feb 2008 18:57:42 +0900
Magnus Damm <magnus.damm@gmail.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.

      parent reply	other threads:[~2008-02-13  0:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08  9:57 Magnus Damm
2008-02-12 11:51 ` Ben Dooks
2008-02-13  0:04 ` Andrew Morton [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=20080212160407.2e2f64ce.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ben@fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --subject='Re: [PATCH] sm501: Add uart support' \
    /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

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).