Thread (86 messages) 86 messages, 6 authors, 2021-08-23

Re: [PATCH Part1 RFC v4 15/36] x86/mm: Add support to validate memory when changing C-bit

From: Borislav Petkov <bp@alien8.de>
Date: 2021-08-17 18:17:10
Also in: linux-coco, linux-crypto, linux-efi, linux-mm, lkml, platform-driver-x86

On Tue, Aug 17, 2021 at 01:07:40PM -0500, Brijesh Singh wrote:
quoted
quoted
+	if (!desc)
+		panic("failed to allocate memory");
Make that error message more distinctive so that *if* it happens, one
can pinpoint the place in the code where the panic comes from.
Now I am running checkpatch and notice that it complain about the message
too. I can add a BUG() or WARN() to get the stack trace before the crashing.
checkpatch complains because there's a kmalloc before it and if it
fails, the mm core will issue a warning so there's no need for a warning
here.

But in this case, you want to panic and checkpatch doesn't see that so
you can ignore it here and leave the panic message but make it more
distinctive so one can find it by grepping. IOW, something like

	if (!desc)
		panic("SEV-SNP: Failed to allocame memory for PSC descriptor");

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help