From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 316C9C7618D for ; Thu, 9 Mar 2023 16:03:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 92F4C10E883; Thu, 9 Mar 2023 16:02:37 +0000 (UTC) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A74610E1A8 for ; Thu, 9 Mar 2023 16:02:09 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BFF1922148; Thu, 9 Mar 2023 16:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1678377727; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+o0nKnK7DSPy1Ib3Bv1R1mVbwQPH782fXsSg9TrWayg=; b=ds9BVXOXcsc0L1GpIOU5m5mEsLa2GZFmgjUEVW1kVdMlOc11Zz4N8EAov+7woqI7LF5+3C sq74CAdP0eh2oIhJBY/S+ftDm3zDFektGWxf5t6SBO+dvPbVX0pDSj82wnHpRt0M224YBN kJ9+VNHyI5Ewx5Dbkx2LfsAw983rHjA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1678377727; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+o0nKnK7DSPy1Ib3Bv1R1mVbwQPH782fXsSg9TrWayg=; b=cAXmDe1ZXcW9Oq/X5vQNlcBGtv2ULwaGXsQK4pBNgTlpeAJLp/70WKkMESVoPnTLdPQZtx sQ55D/b67gXXUwDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 611E013A73; Thu, 9 Mar 2023 16:02:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UGDFFv8CCmQHbgAAMHmgww (envelope-from ); Thu, 09 Mar 2023 16:02:07 +0000 From: Thomas Zimmermann To: deller@gmx.de, geert+renesas@glider.be, timur@kernel.org, rdunlap@infradead.org, paulus@samba.org, benh@kernel.crashing.org, linux@armlinux.org.uk, pjones@redhat.com, adaplas@gmail.com, s.hauer@pengutronix.de, shawnguo@kernel.org, mbroemme@libmpq.org, thomas@winischhofer.net, James.Bottomley@HansenPartnership.com, sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com, corbet@lwn.net Subject: [PATCH v2 008/101] fbdev/arkfb: Duplicate video-mode option string Date: Thu, 9 Mar 2023 17:00:28 +0100 Message-Id: <20230309160201.5163-9-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309160201.5163-1-tzimmermann@suse.de> References: <20230309160201.5163-1-tzimmermann@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Zimmermann , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Assume that the driver does not own the option string or its substrings and hence duplicate the option string for the video mode. Allocate the copy's memory with kstrdup() and free it in the module's exit function. Done in preparation of switching the driver to struct option_iter and constifying the option string. v2: * replace static memory with kstrdup()/kfree() (Geert) Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/arkfb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index 60a96fdb5dd8..98c710cadaab 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -97,6 +97,7 @@ static const struct svga_timing_regs ark_timing_regs = { /* Module parameters */ +static char *mode_option_buf; static char *mode_option = "640x480-8@60"; MODULE_AUTHOR("(c) 2007 Ondrej Zajicek "); @@ -1178,6 +1179,7 @@ static void __exit arkfb_cleanup(void) { pr_debug("arkfb: cleaning up\n"); pci_unregister_driver(&arkfb_pci_driver); + kfree(mode_option_buf); } /* Driver Initialisation */ @@ -1196,8 +1198,10 @@ static int __init arkfb_init(void) if (fb_get_options("arkfb", &option)) return -ENODEV; - if (option && *option) - mode_option = option; + if (option && *option) { + mode_option_buf = kstrdup(option, GFP_KERNEL); // ignore errors + mode_option = mode_option_buf; + } #endif pr_debug("arkfb: initializing\n"); -- 2.39.2