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 DF26AC6FD1F for ; Tue, 14 Mar 2023 16:05:01 +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 8E47E133A; Tue, 14 Mar 2023 17:04:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8E47E133A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1678809899; bh=/acl6j4I+NZzv5xHsqOjSqr3+Qbi8dxMbStRJpTTgkM=; h=Date:From:To:Subject:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=A7ksyClqhoSKAs5Rjnm+GoVSZvvZvn1nNzbDD4ZxBMgsJ2w39M56A81xhW2SMm6eZ KdKE50NecGDAlU8Clg9qYuzAQx9fprS8ajE1OeSqASyWaqUfOyROgQUw/UCxLEosPr ZnSpG2YI9n9Fzr4JrKTTM/RAEM6AxPXint5bjNnU= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C72BDF80423; Tue, 14 Mar 2023 17:03:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 535D0F80423; Tue, 14 Mar 2023 17:03:44 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1EA97F800C9 for ; Tue, 14 Mar 2023 17:03:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1EA97F800C9 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=OmbRgRrM; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Q2vfQKx8 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-out2.suse.de (Postfix) with ESMTPS id C523A1F8B5; Tue, 14 Mar 2023 16:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1678809811; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oQ5Qoe3so/8p+ezgqcR+LYuwsQhHdUhGaFSG7Qtgp4Y=; b=OmbRgRrMciGmDi+OBCoFWN4SUGtCKXZtA4b23EdiFLwWNMnUeOkyVB/X+wWmgbq6cYc24o TuF77YeEvgnmY7vqw89DyKyvr2+MZdRA9bNhLzlDhBIstWQZUwZA5gbJ2JnhSw+U9a4Qyd eIrbnZ/UEieEJv/CvRlLa/n/IM6koGE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1678809811; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oQ5Qoe3so/8p+ezgqcR+LYuwsQhHdUhGaFSG7Qtgp4Y=; b=Q2vfQKx8lCVBIxUU3ocJPPXJ9AESjLlctWL1lqH7POHSu4Tp+yBZU+ifi++Kiy/Jbm1EGU HKdFGgl9ClhwdPBQ== 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 AF20A13A1B; Tue, 14 Mar 2023 16:03:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id O0gvKtOaEGT+VgAAMHmgww (envelope-from ); Tue, 14 Mar 2023 16:03:31 +0000 Date: Tue, 14 Mar 2023 17:03:31 +0100 Message-ID: <87h6unb9rg.wl-tiwai@suse.de> From: Takashi Iwai To: Kuninori Morimoto Subject: Re: [PATCH] ALSA: asihpi: check pao in control_message() In-Reply-To: <87ttypeaqz.wl-kuninori.morimoto.gx@renesas.com> References: <87ttypeaqz.wl-kuninori.morimoto.gx@renesas.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Message-ID-Hash: B6YQ2JXKQQJYX3JZUM3T57H5CI4XAVOV X-Message-ID-Hash: B6YQ2JXKQQJYX3JZUM3T57H5CI4XAVOV X-MailFrom: tiwai@suse.de 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: Linux-ALSA 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 Mon, 13 Mar 2023 01:49:24 +0100, Kuninori Morimoto wrote: > > control_message() might be called with pao = NULL. > Here indicates control_message() as sample. > > (B) static void control_message(struct hpi_adapter_obj *pao, ...) > { ^^^ > struct hpi_hw_obj *phw = pao->priv; > ... ^^^ > } > > (A) void _HPI_6205(struct hpi_adapter_obj *pao, ...) > { ^^^ > ... > case HPI_OBJ_CONTROL: > (B) control_message(pao, phm, phr); > break; ^^^ > ... > } > > void HPI_6205(...) > { > ... > (A) _HPI_6205(NULL, phm, phr); > ... ^^^^ > } > > Therefore, We will get too many warning via cppcheck, like below > > sound/pci/asihpi/hpi6205.c:238:27: warning: Possible null pointer dereference: pao [nullPointer] > struct hpi_hw_obj *phw = pao->priv; > ^ > sound/pci/asihpi/hpi6205.c:433:13: note: Calling function '_HPI_6205', 1st argument 'NULL' value is 0 > _HPI_6205(NULL, phm, phr); > ^ > sound/pci/asihpi/hpi6205.c:401:20: note: Calling function 'control_message', 1st argument 'pao' value is 0 > control_message(pao, phm, phr); > ^ > Set phr->error like many functions doing, and don't call _HPI_6205() > with NULL. > > Signed-off-by: Kuninori Morimoto Thanks, applied. Takashi