Re: [PATCH v3] MM: CMA: add a simple kernel module as the helper totest CMA

From: Michal Nazarewicz
Date: Wed Mar 07 2012 - 05:59:06 EST


Thanks! Some minor comments, hopefully last ones:

On Wed, 07 Mar 2012 04:14:58 +0100, Barry Song <Barry.Song@xxxxxxx> wrote:
+static ssize_t
+cma_test_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
+{

[...]

+ _dev_info(cma_dev, "free: CM virt: %p dma: %p size:%uK\n",

This should read: âsize: %zuKâ. âzâ is the proper modifier to use for size_t type.

+ alloc->virt, (void *)alloc->dma, alloc->size / SZ_1K);
+ kfree(alloc);
+
+ return 0;
+}

+static ssize_t
+cma_test_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+{
+ struct cma_allocation *alloc;
+ size_t size;
+ int ret;
+
+ ret = kstrtouint_from_user(buf, count, 0, &size);

kstrtouint_from_user() expects pointer to unsigned int, size_t is not always
unsigned int. It may be unsigned long. As such, size should be of type
unsigned long and this line should use kstrtoulong_from_user().

[...]

+ if (alloc->virt) {
+ _dev_info(cma_dev, "alloc: virt: %p dma: %p size: %uK\n",
+ alloc->virt, (void *)alloc->dma, size);

Like previously, this should be âsize: %zuKâ.

[...]

+}

--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, MichaÅ âmina86â Nazarewicz (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--
--
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/