All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 01/25] ipmi:ssif: Handle a possible NULL pointer reference
@ 2020-02-23  2:23 Sasha Levin
  2020-02-23  2:23   ` Sasha Levin
                   ` (23 more replies)
  0 siblings, 24 replies; 29+ messages in thread
From: Sasha Levin @ 2020-02-23  2:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Corey Minyard, kbuild test robot, Sasha Levin, openipmi-developer

From: Corey Minyard <cminyard@mvista.com>

[ Upstream commit 6b8526d3abc02c08a2f888e8c20b7ac9e5776dfe ]

In error cases a NULL can be passed to memcpy.  The length will always
be zero, so it doesn't really matter, but go ahead and check for NULL,
anyway, to be more precise and avoid static analysis errors.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/char/ipmi/ipmi_ssif.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index af44db2dfb68a..fec679433f72d 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -735,10 +735,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
 	flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
 	msg = ssif_info->curr_msg;
 	if (msg) {
+		if (data) {
+			if (len > IPMI_MAX_MSG_LENGTH)
+				len = IPMI_MAX_MSG_LENGTH;
+			memcpy(msg->rsp, data, len);
+		} else {
+			len = 0;
+		}
 		msg->rsp_size = len;
-		if (msg->rsp_size > IPMI_MAX_MSG_LENGTH)
-			msg->rsp_size = IPMI_MAX_MSG_LENGTH;
-		memcpy(msg->rsp, data, msg->rsp_size);
 		ssif_info->curr_msg = NULL;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2020-02-23  2:30 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-23  2:23 [PATCH AUTOSEL 4.19 01/25] ipmi:ssif: Handle a possible NULL pointer reference Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 02/25] drm/msm: Set dma maximum segment size for mdss Sasha Levin
2020-02-23  2:23   ` Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 03/25] sched/core: Don't skip remote tick for idle CPUs Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 04/25] dax: pass NOWAIT flag to iomap_apply Sasha Levin
2020-02-23  2:23   ` Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 05/25] mac80211: consider more elements in parsing CRC Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 06/25] cfg80211: check wiphy driver existence for drvinfo report Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 07/25] s390/zcrypt: fix card and queue total counter wrap Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 08/25] qmi_wwan: re-add DW5821e pre-production variant Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 09/25] qmi_wwan: unconditionally reject 2 ep interfaces Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 10/25] arm/ftrace: Fix BE text poking Sasha Levin
2020-02-23  2:23   ` Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 11/25] ARM: dts: sti: fixup sound frame-inversion for stihxxx-b2120.dtsi Sasha Levin
2020-02-23  2:23   ` Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 12/25] soc/tegra: fuse: Fix build with Tegra194 configuration Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 13/25] net: ena: fix potential crash when rxfh key is NULL Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 14/25] net: ena: fix uses of round_jiffies() Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 15/25] net: ena: add missing ethtool TX timestamping indication Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 16/25] net: ena: fix incorrect default RSS key Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 17/25] net: ena: rss: fix failure to get indirection table Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 18/25] net: ena: rss: store hash function as values and not bits Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 19/25] net: ena: fix incorrectly saving queue numbers when setting RSS indirection table Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 20/25] net: ena: ethtool: use correct value for crc32 hash Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 21/25] net: ena: ena-com.c: prevent NULL pointer dereference Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 22/25] enic: prevent waking up stopped tx queues over watchdog reset Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 23/25] cifs: Fix mode output in debugging statements Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 24/25] bcache: ignore pending signals when creating gc and allocator thread Sasha Levin
2020-02-23  2:23 ` [PATCH AUTOSEL 4.19 25/25] cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.