From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752587AbdCEWnK (ORCPT ); Sun, 5 Mar 2017 17:43:10 -0500 Received: from mga07.intel.com ([134.134.136.100]:13261 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbdCEWnI (ORCPT ); Sun, 5 Mar 2017 17:43:08 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,250,1484035200"; d="scan'208";a="232577534" Date: Mon, 6 Mar 2017 06:42:41 +0800 From: kbuild test robot To: Sachin Prabhu Cc: kbuild-all@01.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, Steve French , Pavel Shilovsky , linux-kernel@vger.kernel.org Subject: [PATCH] fix alloc_cast.cocci warnings Message-ID: <20170305224241.GA108280@athens.lkp.intel.com> References: <201703060637.SQGYTNgP%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201703060637.SQGYTNgP%fengguang.wu@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fs/cifs/smb2misc.c:689:14-41: WARNING: casting value returned by memory allocation function to (struct close_cancelled_open *) 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 CC: Sachin Prabhu Signed-off-by: Fengguang Wu --- smb2misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c @@ -686,7 +686,7 @@ smb2_handle_cancelled_mid(char *buffer, (sync_hdr->Status != STATUS_SUCCESS)) return 0; - cancelled = (struct close_cancelled_open *) + cancelled = kzalloc(sizeof(struct close_cancelled_open), GFP_KERNEL); if (!cancelled)