Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp508569rdh; Wed, 14 Feb 2024 03:45:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGeDImk76n/Wp6yG/IQ/lMS4WGOg3tjy3QI4k4sM/WvnkxIN31vWrOVMEJChR2ibflHQ//BGchXFA6MhN0aB/kUtJqDwevYyd2KuT50A== X-Google-Smtp-Source: AGHT+IGK0GdDQmNEv6k6qA+qmejKsbPwhsQqFwUodDGbitZLtFbuAY84G0TLSLGEzS1FuHEFkVgm X-Received: by 2002:a05:6870:31c2:b0:214:ca3c:54fc with SMTP id x2-20020a05687031c200b00214ca3c54fcmr2418591oac.20.1707911144100; Wed, 14 Feb 2024 03:45:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707911144; cv=pass; d=google.com; s=arc-20160816; b=0zPbt7s71tcnZwg+70kxNkMD4Ghlpf8/pGJV29vW0ZVKuir9J4zPq/oFPe0m09ohco CyZxiRPKRDW7xkReOSaO2tauwkwo3P6h4T41qka22fkgxKnexjSt4LYJ+EiSjsAxwBgy bEn9Rr9gY2zb6swdgH8vLymqnfMwDQwQj8dQ/zCKhDxouQCL2tR6lfdwufTfR1J/XKcr xyeMTFMBK40FZPK9JKxjsv3Ym4iJqyEv1Nwoe96JrNMk75STCO2BqfKAkJJ8tsc2vGtf c/q6NK4lw2u+h7G6Z3Y7CKj9xExvIvEbKL2sJEaMWBGRcSUjg0444RxMXlW6hXsR2wvY D+0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=kxIyYzxOV3nh9HraFjdth4tMMfmT9KWuLu4edl2ED40=; fh=5ZPHIzjXf9G6lz8wJJbsSk39Xx5IBK8C6iDDVGClKtM=; b=BA3UTrYX96G8esUVmdZwWuvmspbqJAYWs8xrGBeSgGox6mwJF36B1f4eyeBzcDN1a/ xN/4Va5zXXoSA1+mBWaEGyA7RkfgieJRJEVvfFadPB1VkwoePxJinjzMLtlziP5uczBp J0Vi+sjZc2xIGeF1SszGnI1b7ZXUpCKfhKve8DmuXjaxQm113iCxhdnp0kPHM9EsarHt +djV7voJYl5pWyT40M3UVnKRYO+OMWQAfakTSD6pdI9BwU3Imc+W9350WVxVEAY2kdrv sfF5BVxO5YQrSj9SwTgmbe2jBNuUiPll5Fs93hDBG5W8lcH9rIBV9ilSgDbmphur3rEu SiiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=RJWwqUfN; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=RJWwqUfN; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-65147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=2; AJvYcCWK5jQeBYn7ZIugiBTFfvS4dGG04U04t5Gqe3uqkgWG6w8Pebtv84gexQ7OWd7UemmcZAZ2hgsBFQ26yDgvSaInpsGZJS+nMxf5gVjKaw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l184-20020a6388c1000000b005d8e2f778c7si3606104pgd.294.2024.02.14.03.45.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:45:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=RJWwqUfN; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=RJWwqUfN; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-65147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0F1BC285623 for ; Wed, 14 Feb 2024 11:38:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E19B1CA82; Wed, 14 Feb 2024 11:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="RJWwqUfN"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Td7Ix7OG"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="RJWwqUfN"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Td7Ix7OG" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 588B11C69F for ; Wed, 14 Feb 2024 11:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910672; cv=none; b=sA8RFojEVRJB/PAOEHBmVgrx8Uu2of//abrwuFpbnhkVXnqPs8+EAxD2FvjAmUpC8HLy586btkubHU6ZCY+whXi9Qe47F7AgDDAXN0E7LDBPFskLNgjOYaEX4/xAX7Ed/FSDlFpKssNfglqDMLsSoEPPRbDDHrE+xVTq0PxsaQg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910672; c=relaxed/simple; bh=tUKnbRsubt1txfD8Snvz460QTKeRpLCyiZ24LRq4HE4=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=SI+X96ubxXafv3BB7Z1z/YGdyeC9dgHj5hIIUOo0fppp4L8sS5h/qdAeHf25phY88uYeS7rrXvOU+3dT+aCZwgen7B8iEZEqRjRxIz+OToPWJV0hPfccDJ7bnPL0902ferNPp0+K+BLOlKvUNhJecrYamkxwnEbWiBOJ+o9UAto= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=RJWwqUfN; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Td7Ix7OG; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=RJWwqUfN; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Td7Ix7OG; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 1C88E1F7F5; Wed, 14 Feb 2024 11:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707910668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxIyYzxOV3nh9HraFjdth4tMMfmT9KWuLu4edl2ED40=; b=RJWwqUfNnC50kOEcV7C9lBZZW6IXlF/M+zzoSJGGPVyuC/N3DSFUJiSndqZAyPWEbi/SfJ SuetIyMZSWj/glnmYbASd6mYSnOXWTseTcPlYDSmH6NcWMOXR77HKe5JfEJ39ToSEMoJW0 2HLSJO1z8ye3irRbCOjyIc+KYpMlm+E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707910668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxIyYzxOV3nh9HraFjdth4tMMfmT9KWuLu4edl2ED40=; b=Td7Ix7OGyXKKX8V/QjHkw3TVNKRaQkjIY821twbMc+JKTREmDRSUlv0oMBcXc8aIMLlzY4 kFyHx1Sbeu/xX0Dg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707910668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxIyYzxOV3nh9HraFjdth4tMMfmT9KWuLu4edl2ED40=; b=RJWwqUfNnC50kOEcV7C9lBZZW6IXlF/M+zzoSJGGPVyuC/N3DSFUJiSndqZAyPWEbi/SfJ SuetIyMZSWj/glnmYbASd6mYSnOXWTseTcPlYDSmH6NcWMOXR77HKe5JfEJ39ToSEMoJW0 2HLSJO1z8ye3irRbCOjyIc+KYpMlm+E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707910668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxIyYzxOV3nh9HraFjdth4tMMfmT9KWuLu4edl2ED40=; b=Td7Ix7OGyXKKX8V/QjHkw3TVNKRaQkjIY821twbMc+JKTREmDRSUlv0oMBcXc8aIMLlzY4 kFyHx1Sbeu/xX0Dg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B705613A6D; Wed, 14 Feb 2024 11:37:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id BBhGKwumzGUiXAAAD6G6ig (envelope-from ); Wed, 14 Feb 2024 11:37:47 +0000 Date: Wed, 14 Feb 2024 12:37:47 +0100 Message-ID: <871q9fi8dw.wl-tiwai@suse.de> From: Takashi Iwai To: "Michael S. Tsirkin" Cc: Aiswarya Cyriac , "jasowang@redhat.com" , "perex@perex.cz" , "tiwai@suse.com" , "linux-kernel@vger.kernel.org" , "alsa-devel@alsa-project.org" , "virtualization@lists.linux-foundation.org" , "virtio-dev@lists.oasis-open.org" , Anton Yakovlev , coverity-bot , Mikhail Golubev-Ciuchea Subject: Re: [PATCH] ALSA: virtio: Fix "Coverity: virtsnd_kctl_tlv_op(): Uninitialized variables" warning. In-Reply-To: <20240214062348-mutt-send-email-mst@kernel.org> References: <20240213085131.503569-1-aiswarya.cyriac@opensynergy.com> <20240213035806-mutt-send-email-mst@kernel.org> <20240214062348-mutt-send-email-mst@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RJWwqUfN; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Td7Ix7OG X-Spamd-Result: default: False [-1.81 / 50.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%]; TAGGED_RCPT(0.00)[coverity-bot]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_LOW(-1.00)[suse.de:dkim]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_TWELVE(0.00)[12]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,opensynergy.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 1C88E1F7F5 X-Spam-Level: X-Spam-Score: -1.81 X-Spam-Flag: NO On Wed, 14 Feb 2024 12:30:19 +0100, Michael S. Tsirkin wrote: > > On Wed, Feb 14, 2024 at 09:08:26AM +0000, Aiswarya Cyriac wrote: > > Hi Michael, > > > > Thank you for reviewing. I have updated my response inline > > > > On Tue, Feb 13, 2024 at 09:51:30AM +0100, Aiswarya Cyriac wrote: > > >> Fix the following warning when building virtio_snd driver. > > >> > > >> " > > >> *** CID 1583619: Uninitialized variables (UNINIT) > > >> sound/virtio/virtio_kctl.c:294 in virtsnd_kctl_tlv_op() > > >> 288 > > >> 289     break; > > >> 290   } > > >> 291 > > >> 292   kfree(tlv); > > >> 293 > > >> vvv CID 1583619: Uninitialized variables (UNINIT) > > >> vvv Using uninitialized value "rc". > > >> 294   return rc; > > >> 295 } > > >> 296 > > >> 297 /** > > >> 298 * virtsnd_kctl_get_enum_items() - Query items for the ENUMERATED element type. > > >> 299 * @snd: VirtIO sound device. > > >> " > > >> > > >> Signed-off-by: Anton Yakovlev > > >> Signed-off-by: Aiswarya Cyriac > > >> Reported-by: coverity-bot > > >> Addresses-Coverity-ID: 1583619 ("Uninitialized variables") > > >> Fixes: d6568e3de42d ("ALSA: virtio: add support for audio controls") > > > > >I don't know enough about ALSA to say whether the patch is correct. But > > >the commit log needs work: please, do not "fix warnings" - analyse the > > >code and explain whether there is a real issue and if yes what is it > > >and how it can trigger. Is an invalid op_flag ever passed? > > >If it's just a coverity false positive it might be ok to > > >work around that but document this. > > > > This warning is caused by the absence of the "default" branch in the > > switch-block, and is a false positive because the kernel calls > > virtsnd_kctl_tlv_op() only with values for op_flag processed in > > this block. > > Well we don't normally have functions validate inputs. > In this case I am not really sure we should bother > with adding dead code. If you really want to, add BUG_ON. Please don't use BUG_ON() in such a case... There is no reason to break the whole operation. thanks, Takashi