-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhotfix-vmu.patch
More file actions
97 lines (83 loc) · 3.27 KB
/
hotfix-vmu.patch
File metadata and controls
97 lines (83 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From 145959acc9580fd285e3502bcda5bc2b7a9bfe8c Mon Sep 17 00:00:00 2001
From: Florian Fuchs <fuchsfl@gmail.com>
Date: Wed, 12 Nov 2025 19:43:06 +0100
Subject: [PATCH 1/3] sh: maple: Fix build error due to missing include of
linux/device.h
Fix build error by adding the missing include of linux/device.h and
removing the then unneeded struct device. linux/maple.h embeds struct
device via struct maple_device, which requires the definition. Otherwise
results in build error:
./include/linux/maple.h:81:16: error: field 'dev' has incomplete type
struct device dev;
^~~
./include/linux/maple.h:86:23: error: field 'drv' has incomplete type
struct device_driver drv;
^~~
Fixes: 313162d0b838 ("device.h: audit and cleanup users in main include dir")
Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
---
drivers/mtd/maps/vmu-flash.c | 1 +
include/linux/maple.h | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 53019d313db7..234cc9ecaa01 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -9,6 +9,7 @@
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/delay.h>
+#include <linux/device.h>
#include <linux/maple.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
diff --git a/include/linux/maple.h b/include/linux/maple.h
index 3be4e567473c..a5e62bcb7e16 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
2.43.0
From 9a8a6b675c5c11fd3466a3dd69e9601374824801 Mon Sep 17 00:00:00 2001
From: Florian Fuchs <fuchsfl@gmail.com>
Date: Wed, 12 Nov 2025 19:44:01 +0100
Subject: [PATCH 2/3] mtd: maps: vmu-flash: Fix fault in unaligned fixup
Use kcalloc() / kzalloc() to allocate the memcard structs, instead of
kmalloc() / kmalloc_array() to prevent access to uninitialized data.
Fixes runtime error: Fault in unaligned fixup: 0000 [#1] at
mtd_get_fact_prot_info.
Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
---
drivers/mtd/maps/vmu-flash.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 234cc9ecaa01..bd5903c8610d 100644
--- a/drivers/mtd/maps/vmu-flash.c 2026-04-22 13:32:23.000000000 +0200
+++ b/drivers/mtd/maps/vmu-flash.c 2026-04-25 17:38:22.028114853 +0200
@@ -547,6 +548,7 @@
mpart->partition = card->partition;
mtd_cur->priv = mpart;
mtd_cur->owner = THIS_MODULE;
+ mtd_cur->dev.parent = &mdev->dev;
pcache = kzalloc_obj(struct vmu_cache);
if (!pcache)
@@ -609,7 +611,7 @@
basic_flash_data = be32_to_cpu(mdev->devinfo.function_data[c - 1]);
- card = kmalloc_obj(struct memcard);
+ card = kzalloc_obj(struct memcard);
if (!card) {
error = -ENOMEM;
goto fail_nomem;
@@ -627,13 +629,13 @@
* Not sure there are actually any multi-partition devices in the
* real world, but the hardware supports them, so, so will we
*/
- card->parts = kmalloc_objs(struct vmupart, card->partitions);
+ card->parts = kzalloc_objs(struct vmupart, card->partitions);
if (!card->parts) {
error = -ENOMEM;
goto fail_partitions;
}
- card->mtd = kmalloc_objs(struct mtd_info, card->partitions);
+ card->mtd = kzalloc_objs(struct mtd_info, card->partitions);
if (!card->mtd) {
error = -ENOMEM;
goto fail_mtd_info;