aboutsummaryrefslogtreecommitdiffstats
path: root/samples/livepatch/livepatch-shadow-mod.c
Commit message (Collapse)AuthorAgeFilesLines
* livepatch: convert timeouts to secs_to_jiffies()Easwar Hariharan2025-01-131-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced secs_to_jiffies(). As the value here is a multiple of 1000, use secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication. This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with the following Coccinelle rules: @@ constant C; @@ - msecs_to_jiffies(C * 1000) + secs_to_jiffies(C) @@ constant C; @@ - msecs_to_jiffies(C * MSEC_PER_SEC) + secs_to_jiffies(C) Link: https://lkml.kernel.org/r/20241210-converge-secs-to-jiffies-v3-18-ddfefd7e9f2a@linux.microsoft.com Signed-off-by: Easwar Hariharan <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Anna-Maria Behnsen <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Daniel Mack <[email protected]> Cc: David Airlie <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dick Kennedy <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Haojian Zhuang <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ilya Dryomov <[email protected]> Cc: Jack Wang <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: James Bottomley <[email protected]> Cc: James Smart <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Jeff Johnson <[email protected]> Cc: Jeff Johnson <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Jeroen de Borst <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Joe Lawrence <[email protected]> Cc: Johan Hedberg <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Jozsef Kadlecsik <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Louis Peens <[email protected]> Cc: Lucas De Marchi <[email protected]> Cc: Luiz Augusto von Dentz <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Marcel Holtmann <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Miroslav Benes <[email protected]> Cc: Naveen N Rao <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Nicolas Palix <[email protected]> Cc: Oded Gabbay <[email protected]> Cc: Ofir Bitton <[email protected]> Cc: Pablo Neira Ayuso <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Praveen Kaligineedi <[email protected]> Cc: Ray Jui <[email protected]> Cc: Robert Jarzmik <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Roger Pau Monné <[email protected]> Cc: Russell King <[email protected]> Cc: Scott Branden <[email protected]> Cc: Shailend Chand <[email protected]> Cc: Simona Vetter <[email protected]> Cc: Simon Horman <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Xiubo Li <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
* livepatch/sample: Use the right type for the leaking data pointerPetr Mladek2020-01-171-2/+2
| | | | | | | | | | | | | The "leak" pointer, in the sample of shadow variable API, is allocated as sizeof(int). Let's help developers and static analyzers with understanding the code by using the appropriate pointer type. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Reviewed-by: Joe Lawrence <[email protected]> Acked-by: Miroslav Benes <[email protected]> Reviewed-by: Kamalesh Babulal <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13Thomas Gleixner2019-05-211-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not see http www gnu org licenses this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details [based] [from] [clk] [highbank] [c] you should have received a copy of the gnu general public license along with this program if not see http www gnu org licenses extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 355 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Reviewed-by: Jilayne Lovejoy <[email protected]> Reviewed-by: Steve Winslow <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
* livepatch: samples: non static warnings fixNicholas Mc Guire2019-01-251-5/+6
| | | | | | | | | | | | | | Sparse reported warnings about non-static symbols. For the variables a simple static attribute is fine - for the functions referenced by livepatch via klp_func the symbol-names must be unmodified in the symbol table and the patchable code has to be emitted. The resolution is to attach __used attribute to the shared statically declared functions. Link: https://lore.kernel.org/lkml/[email protected]/ Suggested-by: Joe Lawrence <[email protected]> Signed-off-by: Nicholas Mc Guire <[email protected]> Acked-by: Miroslav Benes <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* livepatch: check kzalloc return valuesNicholas Mc Guire2018-12-181-0/+4
| | | | | | | | | | | | | | | kzalloc() return should always be checked - notably in example code where this may be seen as reference. On failure of allocation in livepatch_fix1_dummy_alloc() respectively dummy_alloc() previous allocation is freed (thanks to Petr Mladek <[email protected]> for catching this) and NULL returned. Signed-off-by: Nicholas Mc Guire <[email protected]> Fixes: 439e7271dc2b ("livepatch: introduce shadow variable API") Acked-by: Joe Lawrence <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Acked-by: Miroslav Benes <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* livepatch: introduce shadow variable APIJoe Lawrence2017-09-141-0/+224
Add exported API for livepatch modules: klp_shadow_get() klp_shadow_alloc() klp_shadow_get_or_alloc() klp_shadow_free() klp_shadow_free_all() that implement "shadow" variables, which allow callers to associate new shadow fields to existing data structures. This is intended to be used by livepatch modules seeking to emulate additions to data structure definitions. See Documentation/livepatch/shadow-vars.txt for a summary of the new shadow variable API, including a few common use cases. See samples/livepatch/livepatch-shadow-* for example modules that demonstrate shadow variables. [[email protected]: fix __klp_shadow_get_or_alloc() comment as spotted by Josh] Signed-off-by: Joe Lawrence <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Acked-by: Miroslav Benes <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>