Re: [PATCH][RESEND] POSIX message queues, 2.5.50

From: Christoph Hellwig (hch@infradead.org)
Date: Tue Dec 03 2002 - 10:12:40 EST


On Tue, Dec 03, 2002 at 03:56:58PM +0100, Krzysztof Benedyczak wrote:
> +#ifndef _LINUX_MQUEUE_H
> +#define _LINUX_MQUEUE_H
> +
> +#include <linux/init.h>

I don't think you need this..

> +struct mq_attr {
> + long mq_flags; /* message queue flags */
> + long mq_maxmsg; /* maximum number of messages */
> + long mq_msgsize; /* maximum message size */
> + long mq_curmsgs; /* number of messages currently queued */

Please don't use longs as ioctl arguments, better s32. (and why
can't this be unsigned, btw?)

> --- linux-2.5.50-org/ipc/mqueue.c Thu Jan 1 01:00:00 1970
> +++ linux-2.5.50-patched/ipc/mqueue.c Mon Dec 2 21:17:28 2002

No copyright statement at all?

> + if (*off>=FILENT_SIZE)
> + return 0;
> + buffer = kmalloc(FILENT_SIZE,GFP_KERNEL);
> + if (buffer==NULL)
> + return -ENOMEM;
> +
> + *((long *)buffer) = info->qsize;
> + *((pid_t *)(buffer+sizeof(long))) = info->notify_pid;
> + *((int *)(buffer+sizeof(long)+sizeof(pid_t))) =
> + info->notify.sigev_signo;
> + *((int *)(buffer+sizeof(long)+sizeof(pid_t)+sizeof(int))) =
> + info->notify.sigev_notify;
> + retval = FILENT_SIZE - *off;
> + if (copy_to_user(data,buffer+*off,retval))
> + return -EFAULT;
> + *off += retval;
> + return retval;

Where is the buffer freed?

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



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:16 EST