Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp885539pxb; Wed, 3 Feb 2021 22:43:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiABe4u7lkhHOQteZ2BoTqpqegyJAVFY2u2CeEaTtxXfYP98MHl/gcnx75Z0wJoqJdKLE6 X-Received: by 2002:aa7:c0cd:: with SMTP id j13mr6612480edp.156.1612421003892; Wed, 03 Feb 2021 22:43:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612421003; cv=none; d=google.com; s=arc-20160816; b=U3FCMXygtn1KOdqeNqL2U7c6yO4fCDkX27pyKCHnpR4g2JgIuU5IlXSbejwInnM7eq ad7DP/y3aP1u+e0Dz3mN8fu/mfx1dALvOCEkR7CvN3fYNK1L2UmDiAn5vmGnx2aovrN1 TxEsjGtCg1heKBmGq+ir9LMwBECpd/TGPuTbHI0N3GG1vhDW868pWddVdQkhcR3g8458 ycn9WJ/yddQWA7K5PXBKw1vrhAmeyz7pEgwjrsuUTnJpTGXjW/x67eXdp6W9ykH8OYee KDBDK/Tum8TCsdJX4sZsSvRyswOBc+vTX0j+j3f0YdCtOYf6xf+JLTRglW1mQWEB4LTP mQuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=mqFj6pK++9+BhH4P4+/swK+CDJclJHratBFRm+N31lw=; b=k8eVDyU28VmGcZ5xRSpBZvgLx8U23SUoR4i9NC8JiQaV58U14ij/vkHlUPcQ8m8wN7 howOb/UnUBHYLMBo7gq4d/nqgZhDEcARU25wMjeEJnTnRr8Sy4CjAOjC//Vyx6JMW/E3 ez5hR7gRzPbYXpX3vMXFNgTO11zR7NJzmRWHlRyKkVs+dYA6wC//f0etkIX3jRMda+Lh jUhJfGZ7uqU8p6Z1Vh75oCMq7LlmK3j+OCYpuUhZA++RRjBQUQNHK2bBjPLrNq+FoVDS Z4jXW5+CZfdW5v6RUR2T9cP9j8aokV+u2uWYTdG5M7DDrKlR1j/cIZ2OKZcZxJ/0vjoB xtIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u7si2742838ejm.392.2021.02.03.22.42.57; Wed, 03 Feb 2021 22:43:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232727AbhBDGlS (ORCPT + 99 others); Thu, 4 Feb 2021 01:41:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:60686 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbhBDGlR (ORCPT ); Thu, 4 Feb 2021 01:41:17 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3B322AC97; Thu, 4 Feb 2021 06:40:36 +0000 (UTC) Date: Thu, 04 Feb 2021 07:40:35 +0100 Message-ID: From: Takashi Iwai To: Xu Wang Cc: perex@perex.cz, tiwai@suse.com, alexander@tsoy.me, e.burema@gmail.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: usb-audio: endpoint : remove redundant check before usb_free_coherent() In-Reply-To: <20210204020518.76619-1-vulab@iscas.ac.cn> References: <20210204020518.76619-1-vulab@iscas.ac.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 04 Feb 2021 03:05:18 +0100, Xu Wang wrote: > > usb_free_coherent() is safe with NULL addr and this check is > not required. The check there isn't about NULL buffer or not; instead it checks whether the buffer was allocated for each or it shares the single buffer (for sync endpoints). In the latter case, your patch will lead to double-free. thanks, Takashi