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 E502FC433EF for ; Sat, 26 Mar 2022 08:09:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232043AbiCZILD (ORCPT ); Sat, 26 Mar 2022 04:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiCZIK6 (ORCPT ); Sat, 26 Mar 2022 04:10:58 -0400 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024354F9CB for ; Sat, 26 Mar 2022 01:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648282162; x=1679818162; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=5Lo509evF0DkyV9oy2CvXO7pUDHwBMp/BuZnKCZ3CFY=; b=GQbTKsTjgbcb2mccGZz4+4S81qaG7J5JZOZY/dLzegeg0fRcx4aWvbMi EgnETC3MyoNM5pAt4yTuHV0sFDy6f3x2gsG2ykOFX1oYsak+jUSCS1yIm C9YDB7F/c9A2Vh5Y9pXsbKciAXZ5reYlf0CVEJ+pHU01z+JSrPvw7nb08 oliRqGiif2HUqwO345JYKdtDvG28exm3V6AJB5K27UE8B9R042r20/0wL AM7V1cvrieXDR5/1/bKi3hXqQmxtWL591hqAbbRgi0P9Ju2E/5lb2MVUk ODofB0ZWkWcnq7eVYo1QYRtcwRFUgdg56Z6IU5X6Y7cLbQZwK6eV/UbC6 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10297"; a="319471312" X-IronPort-AV: E=Sophos;i="5.90,211,1643702400"; d="scan'208";a="319471312" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2022 01:09:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,211,1643702400"; d="scan'208";a="718463852" Received: from lkp-server02.sh.intel.com (HELO 89b41b6ae01c) ([10.239.97.151]) by orsmga005.jf.intel.com with ESMTP; 26 Mar 2022 01:09:20 -0700 Received: from kbuild by 89b41b6ae01c with local (Exim 4.92) (envelope-from ) id 1nY1U7-000NAr-Ow; Sat, 26 Mar 2022 08:09:19 +0000 Date: Sat, 26 Mar 2022 16:09:00 +0800 From: kernel test robot To: Andi Kleen Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Kuppuswamy Sathyanarayanan Subject: [PATCH] swiotlb: fix alloc_cast.cocci warnings Message-ID: <20220326080900.GA72334@bd57dd6d74fb> References: <202203261644.zQlZ2Jw4-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202203261644.zQlZ2Jw4-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: 4ab45cefa80f ("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: 4c095660b91dbdd18042456e395af0deeef93485 commit: 4ab45cefa80f97ba2bdc31226523c891832d1080 [65/83] swiotlb: Split up single swiotlb lock :::::: branch date: 13 hours ago :::::: commit date: 3 days 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) {