Re: [PATCH 24/69] TTY: con3215, centralize allocation

From: Heiko Carstens
Date: Tue Apr 03 2012 - 01:56:53 EST


On Mon, Apr 02, 2012 at 01:54:08PM +0200, Jiri Slaby wrote:
> There are two copies of allocations of device information. One of them
> is totally broken. See:
> raw->cdev = cdev;
> raw->inbuf = (char *) raw + sizeof(struct raw3215_info);
> memset(raw, 0, sizeof(struct raw3215_info));
>
> It suggests that this path was never executed. The code uses both
> raw->cdev and raw->inbuf all over. And it is NULL due to the memset
> here, so it would panic immediately. I believe nobody used that driver
> without being a system console.
>
> Either way, let us fix it by moving the allocations (and
> initializations) to a single place. This will save us some double
> initializations later too.
>
> And while at it, initialize the timer properly -- once, at the
> allocation.
>
> Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
> Cc: linux390@xxxxxxxxxx
> Cc: linux-s390@xxxxxxxxxxxxxxx
> ---
> drivers/s390/char/con3215.c | 74 +++++++++++++++++++++++--------------------
> 1 file changed, 39 insertions(+), 35 deletions(-)

Nice!

Acked-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/