From patchwork Wed Apr 30 14:35:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 4094461 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D01E49F3A0 for ; Wed, 30 Apr 2014 14:35:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E578202FF for ; Wed, 30 Apr 2014 14:35:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E059020265 for ; Wed, 30 Apr 2014 14:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422816AbaD3Of1 (ORCPT ); Wed, 30 Apr 2014 10:35:27 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:33497 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422655AbaD3OfX (ORCPT ); Wed, 30 Apr 2014 10:35:23 -0400 Received: by mail-wg0-f42.google.com with SMTP id k14so1767719wgh.1 for ; Wed, 30 Apr 2014 07:35:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=qRBE8S1y8XnzuOYQ5w9Aq1eZrr5nFQOfT0ejSWO13fw=; b=eiyX/4/PN0l+9AHfPeP+CZ2sO0QCVR+UMjWl4HdIXxjIo2uo5DXCSjxpNpYfFFjjjs zjKbJyXWjpZKvfIJGMuKboDuaeNP2Lop8RCfChTblGj9qS9rtPChN2qCleEvGYycinYl u1ROxxn4q/uGbMjx9NXylhb3pnNET7sNJ/H65wamr0PU8FzO/SWgFNeJL9A9BTKmLLo0 YDc3CGbWR8TOqsYV5DRzvnlKLAECe882Fc6hPGqVPEShJuRI5jJ0CwzPzmuwm/FKbUJE V23S4fD3ReY0iuWxNgfqrot8QDaXxybZGesGaTjEE3KsgqZ6AyQjJVQ7nhJvdVioj0Kg upXw== X-Gm-Message-State: ALoCoQlafIRLL+GTqaUwtg5w/u1AHpy7SpPRYqYf3FNucy5hukzKEx9Q+WDTOrRtLT8pWycuULH8 X-Received: by 10.194.109.227 with SMTP id hv3mr4445200wjb.10.1398868522174; Wed, 30 Apr 2014 07:35:22 -0700 (PDT) Received: from [10.223.0.94] (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id by1sm36449234wjc.26.2014.04.30.07.35.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 07:35:21 -0700 (PDT) Message-ID: <53610A28.7040201@dev.mellanox.co.il> Date: Wed, 30 Apr 2014 10:35:20 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Tomer Cohen Subject: [PATCH opensm] osm_console_io.c: Handle return value of function setsockopt Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tomer Cohen Found by Coverity Signed-off-by: Tomer Cohen Signed-off-by: Hal Rosenstock --- opensm/osm_console_io.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/opensm/osm_console_io.c b/opensm/osm_console_io.c index dfc903f..2426b84 100644 --- a/opensm/osm_console_io.c +++ b/opensm/osm_console_io.c @@ -208,8 +208,15 @@ int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_ strerror(errno)); return -1; } - setsockopt(p_oct->socket, SOL_SOCKET, SO_REUSEADDR, - &optval, sizeof(optval)); + + if (setsockopt(p_oct->socket, SOL_SOCKET, SO_REUSEADDR, + &optval, sizeof(optval))) { + OSM_LOG(p_log, OSM_LOG_ERROR, + "ERR 4B06: Failed to set socket option: %s\n", + strerror(errno)); + return -1; + } + sin.sin_family = AF_INET; sin.sin_port = htons(opt->console_port); #ifdef ENABLE_OSM_CONSOLE_SOCKET