From patchwork Thu Aug 24 09:46:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 805396 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xdKHr6BzPz9sPt for ; Thu, 24 Aug 2017 19:48:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751667AbdHXJsy (ORCPT ); Thu, 24 Aug 2017 05:48:54 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:58599 "EHLO mail.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752587AbdHXJrF (ORCPT ); Thu, 24 Aug 2017 05:47:05 -0400 Received: from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1]) by mail.nwl.cc (Postfix) with ESMTP id AE55463860; Thu, 24 Aug 2017 11:47:04 +0200 (CEST) Received: from xsao (localhost [IPv6:::1]) by mail.nwl.cc (Postfix) with ESMTP id 8C8446385D; Thu, 24 Aug 2017 11:47:04 +0200 (CEST) From: Phil Sutter To: Stephen Hemminger Cc: netdev@vger.kernel.org Subject: [iproute PATCH v4 4/4] tipc/bearer: Prevent NULL pointer dereference Date: Thu, 24 Aug 2017 11:46:34 +0200 Message-Id: <20170824094634.4093-5-phil@nwl.cc> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170824094634.4093-1-phil@nwl.cc> References: <20170824094634.4093-1-phil@nwl.cc> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Phil Sutter --- Changes since v2: - Keep assignment and check in separate statements. --- tipc/bearer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tipc/bearer.c b/tipc/bearer.c index c3d4491f8f6ef..0d84570150624 100644 --- a/tipc/bearer.c +++ b/tipc/bearer.c @@ -439,7 +439,7 @@ static int cmd_bearer_enable(struct nlmsghdr *nlh, const struct cmd *cmd, return err; opt = get_opt(opts, "media"); - if (strcmp(opt->val, "udp") == 0) { + if (opt && strcmp(opt->val, "udp") == 0) { err = nl_add_udp_enable_opts(nlh, opts, cmdl); if (err) return err;