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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 D4087C761A6 for ; Mon, 3 Apr 2023 05:27:08 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9E3BB200; Mon, 3 Apr 2023 07:26:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9E3BB200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1680499625; bh=wQh44lZW2uz2woBPzgce/QVEI1pBxtumMBU1U8bok/o=; h=Date:Subject:To:References:From:In-Reply-To:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=dsWiS8uiLb4dPAN38EMYNGuZxTp7sONONtksUbxl15kl3DhEDXQb2tZaJN54GtmCt u2A1gWA2jndKaj8SUgLtA4F88iXcAIiyVyfN/+oEgrofW2SfCkGccm82q0uVvG5RZ0 Ee0w8ejBi2RnLA1OxqOj+JyTV2EGVEQj4lxc/RqY= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id EEEE4F801C0; Mon, 3 Apr 2023 07:25:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5024F8024C; Mon, 3 Apr 2023 07:20:31 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 73653F8015B for ; Mon, 3 Apr 2023 07:20:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 73653F8015B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=O2GauhAK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680499211; x=1712035211; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=wQh44lZW2uz2woBPzgce/QVEI1pBxtumMBU1U8bok/o=; b=O2GauhAKBLpxoL+eOk6ywXteESMznu5yNW7dNCNplc35lQKWPBddC4N2 qU92E6AJTf4+8VOTg1WYSI8S6TJLa55QRTyy9jsqe9EBQcldiNxPdOC5n qPu/6brRwXlx5Vr9auqS3MUh0G5I178T3ZbkXxbUDMAG46TPtZF5nd8WI 3MPvJhKsK5VQ/50zQdhFBkZsgX/K1gnslBvCmVJOJ4xioE5jxMnOwK6/T YvYLQV9WfHbZl3T6gfv5GhPlsIGNvshx/Bc7uVqSo0xluqDrfwpLQs/Du G7sdc19NfkgtrwqoqVp9xXOrLzymzI5CsaMVAdPTnUZOr2d/4ZP345VsD A==; X-IronPort-AV: E=McAfee;i="6600,9927,10668"; a="325810076" X-IronPort-AV: E=Sophos;i="5.98,314,1673942400"; d="scan'208";a="325810076" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2023 22:20:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10668"; a="796892907" X-IronPort-AV: E=Sophos;i="5.98,314,1673942400"; d="scan'208";a="796892907" Received: from singuva-mobl.amr.corp.intel.com (HELO [10.252.52.206]) ([10.252.52.206]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2023 22:20:02 -0700 Message-ID: <8f78395b-5cc3-e5da-90f2-2fa7114ddcfb@linux.intel.com> Date: Mon, 3 Apr 2023 08:20:38 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.9.1 Subject: Re: [bug report] ASoC: SOF: avoid a NULL dereference with unsupported widgets To: Dan Carpenter References: <4826f662-42f0-4a82-ba32-8bf5f8a03256@kili.mountain> <80f2a9e2-a2fb-4543-b381-251bb07876ef@linux.intel.com> Content-Language: en-US From: =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID-Hash: ND5QPBXRVNJBDGCWWYXQGVQND2NVI27E X-Message-ID-Hash: ND5QPBXRVNJBDGCWWYXQGVQND2NVI27E X-MailFrom: peter.ujfalusi@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: guennadi.liakhovetski@linux.intel.com, alsa-devel@alsa-project.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 01/04/2023 10:44, Dan Carpenter wrote: > On Fri, Mar 31, 2023 at 10:14:11AM +0300, Péter Ujfalusi wrote: >> if src_fw_module is NULL then the print will be: >> source (efault) or sink sink.module.name widget weren't set up properly >> >> Guennadi is relying on some black magic in the printk system to handle >> the printing instead of open coding. > > I've done compiler related work and explored some weird aspect of the > C language and I am so fascinated by this. I would have thought it > crashes before the function is called. I cannot even imagine how black > magic like this would work. I think it is not a compiler magic, but kernel magic: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/vsprintf.c#n700 > Is there anyway I can test this? You could, If you have a laptop which uses SOF and it is Intel 11th gen or newer then you can switch it to IPC4 and install the opt-in v2.5 (which would need with 6.4 kernel). Apply this patch to 6.3-rc (or 6.2) and boot up, but unpatched kernel will NULL dereference, so you need to have a backup option. https://github.com/thesofproject/sof-bin The v2.5 is not there as a release,you need to fetch the repo and follow the instructions. Read the instruction in v2.5.x/README.md before attempting to use this release. Now that I look back at the patch, yes it is not obvious, but it is doing a valid thing. -- Péter