Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2498688imm; Mon, 24 Sep 2018 05:30:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV63hoRRAeDSKhlxUiIx0BTfoX33ONnRVyP8u81NEfoWeAnt2j1Lku1f5zb9OP9CAs0+o724+ X-Received: by 2002:a17:902:7488:: with SMTP id h8-v6mr10483321pll.16.1537792234799; Mon, 24 Sep 2018 05:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792234; cv=none; d=google.com; s=arc-20160816; b=yUQV9KjIP0lv9Pu9DXgopWUxmc3jqy6t9RzSENEVAzrp7acyLSrRlr8DbwcBfNwzH0 pzhWUqjHO1umdrPH1ALaH13lJwctzHanudZrLFmdRoevujq1dmxfamn2hb059L6439hs c/454jZI60srUJJ7oNxFyGDcKk+ihnW/kmdu/RIOSk4kXeaVZID4JPQ3zrG6WtORJno3 qiocU5Y/sg0URY1N99Gak+iTr6ZJn0rVTvNpUNNZEiOB1NkUGqzTQKHeVVuEhkdoYNGQ Fa+zNCtlsS2Q63Z0ijg14s8fmB6DQVC6spNdAf5lRhdTge3Yjvbm/I4+GI0Gx/JD/LkD 7fRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=LCrzYhsct/0at+mPqi9xANyF1D+nuew5l0gY/OpMIT0=; b=yedCONGd8SsEkHydLvNgQKAzbYg5r5qjRwxW4+xEf4rB0GtUYcJXTV6+0Bcw/QU6Wu eVc//2Rv8IvXp9GFR4qjxFlxA54FR48YngpR9losUyz64TUS4Zc0Rtv34DfiDVZWdcPG rPIGy+tWRB3g8iaHfPcq7XldpBysYDXFrRrdykiLP2T1XX/1WhA0VmheAeVrz5sMe46J GIYbmc1flj1hXj/klDBhHjiS49Y1HjgqUznxGMm/YlLg13jMqAXmjtWk2s+A1cOHDFgF NreG6As93ObNPBYL7rNhyS5toJ7krW7eHmv1h+HcmU2Io2RolV0MrPrltGfFpf6gOKXN RmZg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si33970030plv.26.2018.09.24.05.30.18; Mon, 24 Sep 2018 05:30:34 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387440AbeIXS3r (ORCPT + 99 others); Mon, 24 Sep 2018 14:29:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57356 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730233AbeIXS3q (ORCPT ); Mon, 24 Sep 2018 14:29:46 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E938D1018; Mon, 24 Sep 2018 12:27:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Steffen Klassert , Sasha Levin Subject: [PATCH 4.18 023/235] xfrm: fix passing zero to ERR_PTR() warning Date: Mon, 24 Sep 2018 13:50:09 +0200 Message-Id: <20180924113107.006901177@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: YueHaibing [ Upstream commit 934ffce1343f22ed5e2d0bd6da4440f4848074de ] Fix a static code checker warning: net/xfrm/xfrm_policy.c:1836 xfrm_resolve_and_create_bundle() warn: passing zero to 'ERR_PTR' xfrm_tmpl_resolve return 0 just means no xdst found, return NULL instead of passing zero to ERR_PTR. Fixes: d809ec895505 ("xfrm: do not assume that template resolving always returns xfrms") Signed-off-by: YueHaibing Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_policy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1831,7 +1831,10 @@ xfrm_resolve_and_create_bundle(struct xf /* Try to instantiate a bundle */ err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family); if (err <= 0) { - if (err != 0 && err != -EAGAIN) + if (err == 0) + return NULL; + + if (err != -EAGAIN) XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR); return ERR_PTR(err); }