Subject: Re: [PATCH 1/2] GenWQE: Fix endian issues detected by sparse

From: Frank Haverkamp <[email-masked]>
Date: Tue, 07 Jan 2014 13:30:16 +0100

Hi Dan,

Am Dienstag, den 07.01.2014, 09:41 +0300 schrieb Dan Carpenter:
> Could you also fix this Smatch warning?
> drivers/misc/genwqe/card_dev.c:658 do_flash_update() warn: maybe return -EFAULT instead of the bytes remaining?

I thought i fixed this already in my posting:
   [PATCH] GenWQE: Rework return code for flash-update ioctl
from 22.12.2013 14:16:36:

Here the spot:

@@ -565,14 +552,13 @@ static int do_flash_update(struct genwqe

                rc = copy_from_user(xbuf, buf, tocopy);
                if (rc) {
-                       dev_err(&pci_dev->dev,
-                               "err: could not copy all data rc=%d\n",
rc);
+                       rc = -EFAULT;
                        goto free_buffer;
                }
                crc = genwqe_crc32(xbuf, tocopy, 0xffffffff);

-               dev_info(&pci_dev->dev,
-                        "[%s] DMA: 0x%llx CRC: %08x SZ: %ld %d\n",
+               dev_dbg(&pci_dev->dev,
+                       "[%s] DMA: 0x%llx CRC: %08x SZ: %ld %d\n",
                        __func__, dma_addr, crc, tocopy,
blocks_to_flash);

> 
> Also we shouldn't be doing dev_err() on copy_to/from_user() problems.
> The user can trigger those and flood dmesg.  It is a DoS (annoying).
> 
> regards,
> dan carpenter
> 

In this patch I also removed most of the dev_err() messages. Fixing the
possibility to overflow the logs with error messages from user-side.
Greg did not pick up this patch yet, as far as I can see.

Regards

Frank