artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aea1f3b
)
return early if malloc fails to avoid use after free
author
jsg
<jsg@openbsd.org>
Sat, 3 Feb 2024 09:15:57 +0000
(09:15 +0000)
committer
jsg
<jsg@openbsd.org>
Sat, 3 Feb 2024 09:15:57 +0000
(09:15 +0000)
found by "passing freed memory 'edid'" smatch warning
sys/dev/pci/drm/drm_edid.c
patch
|
blob
|
history
diff --git
a/sys/dev/pci/drm/drm_edid.c
b/sys/dev/pci/drm/drm_edid.c
index
3766ff2
..
ba92bd0
100644
(file)
--- a/
sys/dev/pci/drm/drm_edid.c
+++ b/
sys/dev/pci/drm/drm_edid.c
@@
-2120,8
+2120,10
@@
static struct edid *edid_filter_invalid_blocks(struct edid *edid,
kfree(edid);
#else
new = kmalloc(*alloc_size, GFP_KERNEL);
- if (!new)
+ if (!new)
{
kfree(edid);
+ return NULL;
+ }
memcpy(new, edid, EDID_LENGTH);
kfree(edid);
#endif