Skip to contentSkip to conversation

m68k: atari: Reject bare switches parameter

PATCH New Thorsten Blum 1 participant 1 message Nov 6 m68k architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k: atari: Reject bare switches parameter

When a bare switches parameter is specified on the kernel command line without the '=' separator, early parameter parsing passes NULL to atari_switches_setup(), which then attempts to copy data from address zero to the local switches buffer.

Reject a NULL argument in atari_switches_setup() by returning -EINVAL so early parameter parsing reports the malformed option instead.

Fixes d6713b4091a9 ("m68k: early parameter support")
---
 arch/m68k/atari/config.c | 3 +++
 1 file changed, 3 insertions(+)
arch/m68k/atari/config.c +3 -0
index bdafc86241b7..b82bbf93d8e7 100644
@@ -149,6 +149,9 @@ static int __init atari_switches_setup(char *str)
 	if (!MACH_IS_ATARI)
 		return 0;
 
+	if (!str)
+		return -EINVAL;
+
 	/* copy string to local array, strsep works destructively... */
 	strcpy(switches, str);
 	atari_switches = 0;