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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3E04C433F5 for ; Wed, 16 Feb 2022 04:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245467AbiBPELm (ORCPT ); Tue, 15 Feb 2022 23:11:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238867AbiBPELg (ORCPT ); Tue, 15 Feb 2022 23:11:36 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E9410C8 for ; Tue, 15 Feb 2022 20:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644984685; x=1676520685; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Gaf+DKBUiRjhu+XVkAHRNKpoZvA+AGo07TJG2OrS/PQ=; b=GaStzUcgHxEuuI18I1A69CIWTBQNMjSl72ImIM6zwmiSmgTB0xh6yqyY j+IGp7DuMZ7xY2uF3gkUFKWEEwu/RDUCcnJ4GjWskUuSQiTxmeT91Sw39 g4w3w2a0kOfGq28npFvz6NiRsA09RHDhi+k0eeVUxCDQiok1tdMK1cztO LSxDF+NlNeWQpj1JQe6quoa3rRzP50JiW5eDZra85fD8YkeMKYWO2WMTW vXIX5l1pog2buh7QQq5fBWUUjgBCR4go5mryzcLHFBW2suaYP75AGeagA ZsllfTFMr7caal77RWFwt/ziVXcBGsp8GyY6MdB3d5rGOBPChDXe64aYt Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="250462304" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="250462304" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 20:11:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="636312320" Received: from lkp-server01.sh.intel.com (HELO d95dc2dabeb1) ([10.239.97.150]) by orsmga004.jf.intel.com with ESMTP; 15 Feb 2022 20:11:23 -0800 Received: from kbuild by d95dc2dabeb1 with local (Exim 4.92) (envelope-from ) id 1nKBf1-000AOW-3T; Wed, 16 Feb 2022 04:11:23 +0000 Date: Wed, 16 Feb 2022 12:11:09 +0800 From: kernel test robot To: Andi Kleen Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH] swiotlb: fix alloc_cast.cocci warnings Message-ID: <20220216041109.GA35391@22a7a85ba86c> References: <202202161256.1zrqppDy-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202202161256.1zrqppDy-lkp@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: kernel test robot kernel/dma/swiotlb.c:433:15-33: WARNING: casting value returned by memory allocation function to (struct io_tlb_area *) is useless. Remove casting the values returned by memory allocation functions like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc. Semantic patch information: This makes an effort to find cases of casting of values returned by kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc, kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes the casting as it is not required. The result in the patch case may need some reformatting. Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci Fixes: 77d5cb1c6d4f ("swiotlb: Split up single swiotlb lock") CC: Andi Kleen Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://github.com/intel/tdx.git guest-rebased head: 36c91f6d572820e8556972fd7644bd96798e85d6 commit: 77d5cb1c6d4fe32593d65a38b4732da6c90b8f29 [115/133] swiotlb: Split up single swiotlb lock :::::: branch date: 19 hours ago :::::: commit date: 2 weeks ago kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -430,7 +430,7 @@ swiotlb_late_init_with_tbl(char *tlb, un return -ENOMEM; } - mem->areas = (struct io_tlb_area *)kcalloc(num_areas, + mem->areas = kcalloc(num_areas, sizeof(struct io_tlb_area), GFP_KERNEL); if (!mem->areas) {