Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/dist/drm/i915 Don't pass null pointer ...
details: https://anonhg.NetBSD.org/src/rev/d3622a4ed2fd
branches: trunk
changeset: 464654:d3622a4ed2fd
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Oct 15 18:50:44 2019 +0000
description:
Don't pass null pointer as argument 2 of memcpy(). Same as Linux.
Found by kUBSan.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/intel_dp.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r c5f19cb2a80f -r d3622a4ed2fd sys/external/bsd/drm2/dist/drm/i915/intel_dp.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c Tue Oct 15 18:36:38 2019 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c Tue Oct 15 18:50:44 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_dp.c,v 1.19 2018/09/13 08:25:55 mrg Exp $ */
+/* $NetBSD: intel_dp.c,v 1.20 2019/10/15 18:50:44 msaitoh Exp $ */
/*
* Copyright © 2008 Intel Corporation
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.19 2018/09/13 08:25:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.20 2019/10/15 18:50:44 msaitoh Exp $");
#include <linux/i2c.h>
#include <linux/slab.h>
@@ -989,7 +989,10 @@
if (WARN_ON(txsize > 20))
return -E2BIG;
- memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
+ WARN_ON(!msg->buffer != !msg->size);
+
+ if (msg->buffer)
+ memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
ret = intel_dp_aux_ch(intel_dp, txbuf, txsize, rxbuf, rxsize);
if (ret > 0) {
Home |
Main Index |
Thread Index |
Old Index