From: Marcus Wolf <linux@wolf-entwicklungen.de>
To: gregkh@linuxfoundation.org, dan.carpenter@oracle.com,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: Marcus Wolf <linux@wolf-entwicklungen.de>
Subject: [PATCH] Staging: Pi433: Bugfix for wrong argument for sizeof() in TX thread
Date: Mon, 18 Dec 2017 19:27:58 +0200 [thread overview]
Message-ID: <1513618078-27938-1-git-send-email-linux@wolf-entwicklungen.de> (raw)
sizeof(array) != sizeof(pointer to array)
Fixes: "staging: pi433: reduce stack size in tx thread"
Signed-off-by: Marcus Wolf <linux@wolf-entwicklungen.de>
---
drivers/staging/pi433/pi433_if.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1f3ba55..6e6f595 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -565,7 +565,6 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
struct pi433_device *device = data;
struct spi_device *spi = device->spi;
struct pi433_tx_cfg tx_cfg;
- u8 *buffer = device->buffer;
size_t size;
bool rx_interrupted = false;
int position, repetitions;
@@ -614,19 +613,19 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
size++;
/* prime buffer */
- memset(buffer, 0, size);
+ memset(device->buffer, 0, size);
position = 0;
/* add length byte, if requested */
if (tx_cfg.enable_length_byte == OPTION_ON)
- buffer[position++] = size - 1; /* according to spec length byte itself must be excluded from the length calculation */
+ device->buffer[position++] = size - 1; /* according to spec length byte itself must be excluded from the length calculation */
/* add adr byte, if requested */
if (tx_cfg.enable_address_byte == OPTION_ON)
- buffer[position++] = tx_cfg.address_byte;
+ device->buffer[position++] = tx_cfg.address_byte;
/* finally get message data from fifo */
- retval = kfifo_out(&device->tx_fifo, &buffer[position], sizeof(buffer) - position);
+ retval = kfifo_out(&device->tx_fifo, &device->buffer[position], sizeof(device->buffer) - position);
dev_dbg(device->dev, "read %d message byte(s) from fifo queue.", retval);
mutex_unlock(&device->tx_fifo_lock);
@@ -708,7 +707,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
int temp = device->free_in_fifo;
device->free_in_fifo = 0;
rf69_write_fifo(spi,
- &buffer[position],
+ &device->buffer[position],
temp);
position += temp;
} else {
@@ -716,7 +715,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
device->free_in_fifo -= size;
repetitions--;
rf69_write_fifo(spi,
- &buffer[position],
+ &device->buffer[position],
(size - position));
position = 0; /* reset for next repetition */
}
--
1.7.10.4
next reply other threads:[~2017-12-18 17:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-18 17:27 Marcus Wolf [this message]
2017-12-19 14:14 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513618078-27938-1-git-send-email-linux@wolf-entwicklungen.de \
--to=linux@wolf-entwicklungen.de \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®