X86 platform drivers
 help / color / mirror / Atom feed
From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: linux-kernel@vger.kernel.org,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	platform-driver-x86@vger.kernel.org
Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
Subject: [PATCH 2/2] platform/x86: dell_rbu: Stop overwriting data buffer
Date: Wed, 21 May 2025 11:16:39 -0500	[thread overview]
Message-ID: <20250521161639.47357-3-stuart.w.hayes@gmail.com> (raw)
In-Reply-To: <20250521161639.47357-1-stuart.w.hayes@gmail.com>

The dell_rbu driver will use memset to clear the data held by each packet
when it is no longer needed (when the driver is unloaded, the packet size
is changed, etc).

The amount of memory that is cleared is (currently) the normal packet
size.  However, the last packet in the list may be smaller.  Fix this to
only clear the memory actually used by each packet, to prevent it from
writing past the end of data buffer.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
---
 drivers/platform/x86/dell/dell_rbu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c
index 6a602a80160a..bedf03fa4f41 100644
--- a/drivers/platform/x86/dell/dell_rbu.c
+++ b/drivers/platform/x86/dell/dell_rbu.c
@@ -322,7 +322,7 @@ static void packet_empty_list(void)
 		 * zero out the RBU packet memory before freeing
 		 * to make sure there are no stale RBU packets left in memory
 		 */
-		memset(newpacket->data, 0, rbu_data.packetsize);
+		memset(newpacket->data, 0, newpacket->length);
 		set_memory_wb((unsigned long)newpacket->data,
 			1 << newpacket->ordernum);
 		free_pages((unsigned long) newpacket->data,
-- 
2.47.1


      parent reply	other threads:[~2025-05-21 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 16:16 [PATCH 0/2] platform/x86: dell_rbu: Packet data fixes Stuart Hayes
2025-05-21 16:16 ` [PATCH 1/2] platform/x86: dell_rbu: Fix list usage Stuart Hayes
2025-05-22 13:02   ` kernel test robot
2025-05-21 16:16 ` Stuart Hayes [this message]

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=20250521161639.47357-3-stuart.w.hayes@gmail.com \
    --to=stuart.w.hayes@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@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