From patchwork Sun Mar 5 22:42:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 9604797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF45560234 for ; Sun, 5 Mar 2017 22:43:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEE0D26E4C for ; Sun, 5 Mar 2017 22:43:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3C2227E22; Sun, 5 Mar 2017 22:43:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7610E27D5D for ; Sun, 5 Mar 2017 22:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752559AbdCEWnK (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 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 05 Mar 2017 14:43:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,250,1484035200"; d="scan'208";a="232577534" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by fmsmga004.fm.intel.com with ESMTP; 05 Mar 2017 14:43:05 -0800 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1cketu-000EOm-O8; Mon, 06 Mar 2017 06:45:14 +0800 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-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-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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)