diff options
| author | Ovidiu Panait <ovidiu.panait.oss@gmail.com> | 2025-12-28 00:26:38 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-01-11 15:54:12 +0300 |
| commit | 04efe3aa5fa0f81fe38a0ff8e03c0d5bdfcbad5f (patch) | |
| tree | fbaff0dc2dbf22f1aeb7cc73adf29c76c8a3d6c1 | |
| parent | ab517a047b4ef6b62e4ddabfdd3549f19e4bc4c9 (diff) | |
| download | linux-04efe3aa5fa0f81fe38a0ff8e03c0d5bdfcbad5f.tar.xz | |
staging: axis-fifo: Remove noisy error messages for user errors
Remove dev_err() calls for conditions caused by invalid userspace
input. Logging them clutters the kernel log, especially if userspace
repeatedly makes invalid calls.
Also, consolidate the write validation checks into a single condition.
Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Link: https://patch.msgid.link/20251227212640.3321310-7-ovidiu.panait.oss@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/axis-fifo/axis-fifo.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 6d9ff6384168..bce32e9da347 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -195,8 +195,6 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf, words_available = bytes_available / sizeof(u32); if (bytes_available > len) { - dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu)\n", - bytes_available, len); ret = -EINVAL; goto err_flush_rx; } @@ -268,20 +266,8 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, u32 *txbuf; int ret; - if (len % sizeof(u32)) { - dev_err(fifo->dt_device, - "tried to send a packet that isn't word-aligned\n"); - return -EINVAL; - } - words_to_write = len / sizeof(u32); - if (!words_to_write) { - dev_err(fifo->dt_device, - "tried to send a packet of length 0\n"); - return -EINVAL; - } - /* * In 'Store-and-Forward' mode, the maximum packet that can be * transmitted is limited by the size of the FIFO, which is @@ -291,7 +277,8 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, * otherwise a 'Transmit Packet Overrun Error' interrupt will be * raised, which requires a reset of the TX circuit to recover. */ - if (words_to_write > (fifo->tx_fifo_depth - 4)) + if (!words_to_write || (len % sizeof(u32)) || + (words_to_write > (fifo->tx_fifo_depth - 4))) return -EINVAL; if (f->f_flags & O_NONBLOCK) { |
