From patchwork Wed Jun 15 12:15:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 581976 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 BEA78C433EF for ; Wed, 15 Jun 2022 12:16:16 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C39A718D9; Wed, 15 Jun 2022 14:15:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C39A718D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1655295374; bh=jv8G1agcRVwhrz1O1q4Ch+Z472ENfIeo/WXmazNLAX4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=j5nHSKUO1Pc6iv9Aw6VQRtjzzuGR+CpauUdBGclqIKCXB4fpGcGJaWsrjzmo3cAi2 xyXrGVrLfISP3obCzDSRtPwGfFUtZQfLWIzthJs0XiVzk8V6+t7CzAx19llBpQOa54 gktiNCuWqOqTr8oBfzYGR8iSwMh5dKmYA0zUUZE4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4693DF8016C; Wed, 15 Jun 2022 14:15:24 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D994F801F7; Wed, 15 Jun 2022 14:15:23 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AE026F8012B for ; Wed, 15 Jun 2022 14:15:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AE026F8012B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="UC72yPVi"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="EdSmfthi" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id A20A13200A07; Wed, 15 Jun 2022 08:15:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 15 Jun 2022 08:15:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1655295313; x= 1655381713; bh=U41sdkndxEPcUW2HyhBS60wraWtLaKd+4y+3d1M8lDk=; b=U C72yPViI75uIyif27I908MvytUcWLKm4N0ESE9OMSEsPDU5mEMXIDA1NGBEAx7AB KzgNZFWcrEf7RY6Oq2w3+rcms7VrK/0j6zo3OqehN0dKV42dVZ7eHo007OygHNHm e5z4rRgbEpnFRn1ZuTXyv8RCDKpS61q9wyTNC08LfT0Y1qYOKOVRkF8CyQjRq0rs ORp1YBIy8lCtw6ustyPzQ2wLXkCdMFe4IfUYrT4x2lE3bIL4ci4NtFdjjhLrQlpB kdaOMS2xYnIM0e6r9JYCXP49gHGAPDPz3cxaXeCsXjRFMbbVps1qp3kufzr4FBZf EMV0bqn1Otq4WqKmHND+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655295313; x=1655381713; bh=U41sdkndxEPcU W2HyhBS60wraWtLaKd+4y+3d1M8lDk=; b=EdSmfthiQpm5UGVfTfzka8hJNiyjz OmHGJdMdfl6LLSbZ6CbyGECyy2x2LWpi94UvhdIdozNksOAkvXF9SSgwZIVkVtKd wkTtsIneHKuzVJb9+R2WD0RsaejsaNtjlNGvpoDd8T/s6Kbgse1iJMBcktZ4+3DJ bBLY3ehCoyn2Lv9Gq5b/N9FF8LNsItVm/BDrRW4FTwsSoB2AKUX/nbFC+Y4k6OhK L4mUPMP5oiu8yVcOMDFNIQP4y2kVkObn56eSG3xFrfSo68MUGrm7bLK4G+og6rXe +9ZfRCXIKUvocXxuB9tIw5zwWsYyU+Pc2WsredsWhpKYrfJoWhcPVW//A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvuddggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfgrkhgr shhhihcuufgrkhgrmhhothhouceoohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhird hjpheqnecuggftrfgrthhtvghrnhepvdejgfejuedvgfduudekleevtefgtdevhfdtffef iefgveeuteffiedvffekvddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 08:15:11 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, stefanr@s5r6.in-berlin.de Subject: [PATCH v2 1/3] firewire: convert sysfs sprintf/snprintf family to sysfs_emit Date: Wed, 15 Jun 2022 21:15:03 +0900 Message-Id: <20220615121505.61412-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220615121505.61412-1-o-takashi@sakamocchi.jp> References: <20220615121505.61412-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: Jiapeng Chong , alsa-devel@alsa-project.org, linux1394-devel@lists.sourceforge.net, Abaci Robot X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Jiapeng Chong Fix the following coccicheck warning: ./drivers/firewire/core-device.c:375:8-16: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 90ed8fdaba75..adddd8c45d0c 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -372,8 +372,7 @@ static ssize_t rom_index_show(struct device *dev, struct fw_device *device = fw_device(dev->parent); struct fw_unit *unit = fw_unit(dev); - return snprintf(buf, PAGE_SIZE, "%d\n", - (int)(unit->directory - device->config_rom)); + return sysfs_emit(buf, "%td\n", unit->directory - device->config_rom); } static struct device_attribute fw_unit_attributes[] = { @@ -403,8 +402,7 @@ static ssize_t guid_show(struct device *dev, int ret; down_read(&fw_device_rwsem); - ret = snprintf(buf, PAGE_SIZE, "0x%08x%08x\n", - device->config_rom[3], device->config_rom[4]); + ret = sysfs_emit(buf, "0x%08x%08x\n", device->config_rom[3], device->config_rom[4]); up_read(&fw_device_rwsem); return ret; From patchwork Wed Jun 15 12:15:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 581975 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 6A927C43334 for ; Wed, 15 Jun 2022 12:17:07 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6551F18E8; Wed, 15 Jun 2022 14:16:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6551F18E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1655295425; bh=XX+Aa+fT1RjwyoHoUXPHFjHKmen0LBK6YIBMddLOd4s=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=s7Mspsz4YkzrSGWiR+JyoX6h8kyDlpMfeH8OwtgtpAc4Jiu7OrfU5v6mAIsUqFyAp UW0uM+9yW/F5AP+kMy4j4McAOcSM3GkqFKWNaZpDLZRzdmnjfOqr2JNYaM7RCJ1emo vrulsqFMc9RpnUkrZ5fOiL0Lmi3i0NiMVh/yfO6s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C079EF80527; Wed, 15 Jun 2022 14:15:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9EE80F801F7; Wed, 15 Jun 2022 14:15:26 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 68D19F800B9 for ; Wed, 15 Jun 2022 14:15:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 68D19F800B9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="pOgL8x/L"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PVvL8wis" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id A0E5D320094C; Wed, 15 Jun 2022 08:15:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 15 Jun 2022 08:15:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1655295316; x= 1655381716; bh=MtKBc2bhfjgMYC9HTZUX2V0/dMYlGGjy+AYAPIY7ZaY=; b=p OgL8x/LCbQn1ZNkAoeJT4yLKckCmZt8L9inva/gKLl6CpoP9eEI22A/mBzZX9jnm wqyNxQVfZtkidxjFf8VlyecFpGPQ09/gslVQ5d70YOwlFecNNKsLrTqLySQIjwhL aSx7iJ2RcepelsJ6cf+ZX5C6uHPLVViDbMUCDlGZy1fYbElhRJWB3vIiGHUjzU/c u92UHw8GtvDbS1QFCC8N/ZV5p71LYSX0EMla5a3am/2HjWFlp2BnbaseFbsN1Tqv 6HFt8YnkA54eCI8cLcnghCsLv6D6EGIZyFTLFC+PSum3ZQkQge3ndIeLeMZuJZJx ZEzDhF4eVqN01DYLFN3Xw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655295316; x=1655381716; bh=MtKBc2bhfjgMY C9HTZUX2V0/dMYlGGjy+AYAPIY7ZaY=; b=PVvL8wis2OyJPIAnu6qZutU3QqpUW RtyTWLXpnh6h7PzT0oEq45F+GGr3AMHs0YPPblpfJuxT1o4o33wMMrI7iF7YqmOn huXzEkzdumAHvu34ciSbfvcnwqwwEvMBfXFPB2dVbSde0i+OdxP50ctK3/LlhG2R XLTk6qh85FV+sQ4cGUSfu/DjZpP28hXLrw40c8daTnhHXGKovUakyrVJlyidGfQA mQZeuiKt7CRdkT3M1IHPnZusupUxYy+841Pd/Tw3+kjOOJ05z4Fmrwv4QCtIil1e NWwWh7Js6UJoA5rIh+Sm7fywjqmiI3JhngJQTyUrMPY7bmIC4fG9FFyyg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvuddggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfgrkhgr shhhihcuufgrkhgrmhhothhouceoohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhird hjpheqnecuggftrfgrthhtvghrnhepvdejgfejuedvgfduudekleevtefgtdevhfdtffef iefgveeuteffiedvffekvddtnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpe hmrghilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 08:15:14 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, stefanr@s5r6.in-berlin.de Subject: [PATCH v2 2/3] firewire: use struct_size over open coded arithmetic Date: Wed, 15 Jun 2022 21:15:04 +0900 Message-Id: <20220615121505.61412-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220615121505.61412-1-o-takashi@sakamocchi.jp> References: <20220615121505.61412-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux1394-devel@lists.sourceforge.net, "Minghao Chi \(CGEL ZTE\)" X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: "Minghao Chi (CGEL ZTE)" Replace zero-length array with flexible-array member and make use of the struct_size() helper in kmalloc(). For example: struct fw_request { ... u32 data[]; } Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. (Revised by Takashi Sakamoto to fix the value of third argument.) Signed-off-by: Minghao Chi (CGEL ZTE) Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-transaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index af498d767702..4604a9d97fd1 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c @@ -779,7 +779,8 @@ static struct fw_request *allocate_request(struct fw_card *card, return NULL; } - request = kmalloc(sizeof(*request) + length, GFP_ATOMIC); + request = kmalloc(struct_size(request, data, length / sizeof(request->data[0])), + GFP_ATOMIC); if (request == NULL) return NULL; From patchwork Wed Jun 15 12:15:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 582276 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 45170C43334 for ; Wed, 15 Jun 2022 12:17:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 80BF818B3; Wed, 15 Jun 2022 14:16:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 80BF818B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1655295437; bh=2Gq4UK5OFxK6Lx2fXZvgYIdDEtkN7/S6kUQlYlV03Ec=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HWUXvsWrWxm8SnN+8563TRV2RD9S7GHiOH1vbgYfIuRFYfuH+n1byEhgFj1RsZZtI v8o//G1ZuPbjzsKf7H9AS0gqQ0QyLpkOMTl34AKYsd/+HlS7P8qfhknTkHeU36tGI6 mMfuQuJrFKsQSBgK/GSoQ+YM6tF8pPEmFG0K91PE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 17C3AF804B0; Wed, 15 Jun 2022 14:15:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EC207F80536; Wed, 15 Jun 2022 14:15:33 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7F861F804B0 for ; Wed, 15 Jun 2022 14:15:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7F861F804B0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="1JEDtJam"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZqsY+kUb" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E8E023200A11; Wed, 15 Jun 2022 08:15:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 15 Jun 2022 08:15:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1655295319; x= 1655381719; bh=mn4bqWxQrWS6iJkrNhpBpakosj8nE7J+QhXoG4Ef3II=; b=1 JEDtJamCHSnlV4g3ZJPLlIqoNy6qVp8QffkxG3pLNBxSjRIffTBTuW/txl47hbz/ DWZQTCqA6kvc0HakGZRY1qyZXAx8BHJKk5NSNF/FDQNRsuuSCW+mHR/w1NCHvlWB FijunO/JUg6nnmQ751LdvK8qwRgFSYHs2LEsh5KZ2h2OpUF9hnsMLPVqIRQsp9My xY1Q8bIT7whN6YPZdKrfHa8AvFHKU4K/lnfamVzNW84IbKDCXVpz+7yzx8mclok/ 3u1LmsGvRdEaJOvvhaaEbXXfHfyy4y5Lh6jqo5NUIXo2Y86AtB/ymbgH03o6F4jB hq1yH6LR2kqrstWoa/92g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655295319; x=1655381719; bh=mn4bqWxQrWS6i JkrNhpBpakosj8nE7J+QhXoG4Ef3II=; b=ZqsY+kUb8yhkg2xb1THUEAeG1ub24 z+qTG1sfl/+eVsin+n/MsxKjM4Q2x+7b7KerwrppjuDwdDz6vIc32rfw2tGAOhd/ UWexrYfBbnwaX5FF6WNW6JPV0sar141zYh0GrKG2+SqVejVW/2qqrW9JuPWP5H6S fqC/ErnwRBy6y8ckS2Kl1G/fNwx4+V0GPfM6LgJYPRGwOrMkMS4zAOLnOCcUu0eN QZi4ggg9IMz5SES6H0bP0j8Re3lUtuLwpzhy/lEZdFo9sbXN9CJJ5p778LCncN0I DThlB5Sz+fvp3YTpML+ollHzaTVnlgQ++iXAxOQW5yz01+4xku43ESKJg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvuddggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfgrkhgr shhhihcuufgrkhgrmhhothhouceoohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhird hjpheqnecuggftrfgrthhtvghrnhepvdejgfejuedvgfduudekleevtefgtdevhfdtffef iefgveeuteffiedvffekvddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 08:15:17 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, stefanr@s5r6.in-berlin.de Subject: [PATCH v2 3/3] firewire: Fix using uninitialized value Date: Wed, 15 Jun 2022 21:15:05 +0900 Message-Id: <20220615121505.61412-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220615121505.61412-1-o-takashi@sakamocchi.jp> References: <20220615121505.61412-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux1394-devel@lists.sourceforge.net, Lv Ruyi , Zeal Robot X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Lv Ruyi If data is null, request->data wouldn't be assigned value. It is random value, but we use it in handle_exclusive_region_request() and handle_fcp_region_request() later. Fix the bug by initializing it. (Revised by Takashi Sakamoto to rebase to the previous patch.) Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index 4604a9d97fd1..613aff624391 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c @@ -779,7 +779,7 @@ static struct fw_request *allocate_request(struct fw_card *card, return NULL; } - request = kmalloc(struct_size(request, data, length / sizeof(request->data[0])), + request = kzalloc(struct_size(request, data, length / sizeof(request->data[0])), GFP_ATOMIC); if (request == NULL) return NULL;