Received: by 10.223.164.202 with SMTP id h10csp26091wrb; Thu, 16 Nov 2017 17:55:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMYKu7dqVIomPhVKsQWamwKYSHcB7TnkfyKCeaLpnHpgXa7E/bQnowCgkU394BMy7d4F5rv1 X-Received: by 10.99.126.6 with SMTP id z6mr3606642pgc.305.1510883735655; Thu, 16 Nov 2017 17:55:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510883735; cv=none; d=google.com; s=arc-20160816; b=NpCoKdMLniAiKf4WW6CSpZKEdB73QaktM1FBocKLT0QLsE73r3RlAQK0tI7E946K49 Be+o+uQS93X2zUneXU3cZHrMPH3SuPn9YhewcKtsjVblwN9/SiuyHNe3Tlzfgayus9GF sTy4NcNuo6Qezf8v3yn/MN0ttwhN6q7acRMoc4cdrGm9xma8ahK7H+AHmjxSbGT8xYgF kBr5VKfTJzcYuqPjftb5IkCgJ8nWsjTfKDXRuINEvCWRPGe/iimTjZthMt3Xiy5GAxhV BW256LLD6OuAum8fBKT6fzSxXFWFqBVPSKVh07dCIhkPcsisCcgMAr2l+IK53w+yR0DZ WS3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=53AdHeC1yirM6AxFHy4lcW2ozP24kpJgM39G585HqQg=; b=FNPLA8sTmRRRZrkR79x6AIGK0+NV1LR+SZcHNXjbWuUkJE014jA45syPtrqYQOvWll eY1aa90x+GKmec3wpc/u0Jq5MquQh3zWxnZ8bVPr0Mm9pZ4YDvTymJ8DnFXah+FrkQqo DCB9FdoQufr/zf3s7JOOoVYT9PjjE8FVM7TN3ugaR07Oc2s5r0X4jFEv5FKRxab4SzHd 49ZRflj137ASpl8Z2/oC1eUl6GLwz6WpDu0b/pBLAC0hZN10zYLDOO3ggQLeqFMQpms5 bJxfAvUacI4YnHhDt59WuNy4+TJCTlVTvPHVPKLCyT/UjJ/lN5UVSlneQuH1HKWF5q1c SOaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a27si2027144pfj.117.2017.11.16.17.55.22; Thu, 16 Nov 2017 17:55:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966633AbdKPSPB (ORCPT + 92 others); Thu, 16 Nov 2017 13:15:01 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41936 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966605AbdKPSOl (ORCPT ); Thu, 16 Nov 2017 13:14:41 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAGIEdTt073956 for ; Thu, 16 Nov 2017 13:14:41 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e9crf2nfk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 16 Nov 2017 13:14:40 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Nov 2017 18:14:38 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 16 Nov 2017 18:14:35 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vAGIEZp938142078; Thu, 16 Nov 2017 18:14:35 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 812BE4204B; Thu, 16 Nov 2017 18:09:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21C304203F; Thu, 16 Nov 2017 18:09:27 +0000 (GMT) Received: from oc0447013845.ibm.com (unknown [9.152.222.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 16 Nov 2017 18:09:27 +0000 (GMT) Subject: Re: [PATCH] net/smc: Fix preinitialization of buf_desc in __smc_buf_create() To: Geert Uytterhoeven , "David S . Miller" Cc: Arnd Bergmann , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1510831373-31768-1-git-send-email-geert@linux-m68k.org> From: Ursula Braun Date: Thu, 16 Nov 2017 19:14:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1510831373-31768-1-git-send-email-geert@linux-m68k.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17111618-0012-0000-0000-0000058E2FDC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17111618-0013-0000-0000-00001908F2FC Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-16_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711160243 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/16/2017 12:22 PM, Geert Uytterhoeven wrote: > With gcc-4.1.2: > > net/smc/smc_core.c: In function ‘__smc_buf_create’: > net/smc/smc_core.c:567: warning: ‘bufsize’ may be used uninitialized in this function > > Indeed, if the for-loop is never executed, bufsize is used > uninitialized. In addition, buf_desc is stored for later use, while it > is still a NULL pointer. > > Before, error handling was done by checking if buf_desc is non-NULL. > The cleanup changed this to an error check, but forgot to update the > preinitialization of buf_desc to an error pointer. > > Update the preinitializatin of buf_desc to fix this. > > Fixes: b33982c3a6838d13 ("net/smc: cleanup function __smc_buf_create()") > Signed-off-by: Geert Uytterhoeven > --- > I don't know if this can ever happen, but the old code handled it. The for-loop is at least executed once; thus there is no real problem. Nevertheless the warning is ugly, and the current initialization with NULL meaningless after the smc_buf cleanup. Therefore I add your patch to my list of coming smc patches. Thanks! > --- > net/smc/smc_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c > index 2578fbd95664af84..453c54467082d93f 100644 > --- a/net/smc/smc_core.c > +++ b/net/smc/smc_core.c > @@ -562,7 +562,7 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_rmb) > { > struct smc_connection *conn = &smc->conn; > struct smc_link_group *lgr = conn->lgr; > - struct smc_buf_desc *buf_desc = NULL; > + struct smc_buf_desc *buf_desc = ERR_PTR(-ENOMEM); > struct list_head *buf_list; > int bufsize, bufsize_short; > int sk_buf_size; > From 1584231338913570887@xxx Thu Nov 16 13:58:59 +0000 2017 X-GM-THRID: 1584223648113750422 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread