Skip to content

Commit 3991b04

Browse files
Uwe Kleine-Königbp3tk0v
authored andcommitted
virt: sev-guest: Mark driver struct with __refdata to prevent section mismatch
As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent the following section mismatch warning: WARNING: modpost: drivers/virt/coco/sev-guest/sev-guest: section mismatch in reference: \ sev_guest_driver+0x10 (section: .data) -> sev_guest_remove (section: .exit.text) that triggers on an allmodconfig W=1 build. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/4a81b0e87728a58904283e2d1f18f73abc69c2a1.1711748999.git.u.kleine-koenig@pengutronix.de
1 parent 99ef9f5 commit 3991b04

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/virt/coco/sev-guest/sev-guest.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,13 @@ static void __exit sev_guest_remove(struct platform_device *pdev)
12031203
* This driver is meant to be a common SEV guest interface driver and to
12041204
* support any SEV guest API. As such, even though it has been introduced
12051205
* with the SEV-SNP support, it is named "sev-guest".
1206+
*
1207+
* sev_guest_remove() lives in .exit.text. For drivers registered via
1208+
* module_platform_driver_probe() this is ok because they cannot get unbound
1209+
* at runtime. So mark the driver struct with __refdata to prevent modpost
1210+
* triggering a section mismatch warning.
12061211
*/
1207-
static struct platform_driver sev_guest_driver = {
1212+
static struct platform_driver sev_guest_driver __refdata = {
12081213
.remove_new = __exit_p(sev_guest_remove),
12091214
.driver = {
12101215
.name = "sev-guest",

0 commit comments

Comments
 (0)