From patchwork Fri Nov 15 05:07:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1195347 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="WLeVC+bb"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47Dn3d45fRz9sPF for ; Fri, 15 Nov 2019 16:29:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727208AbfKOF3p (ORCPT ); Fri, 15 Nov 2019 00:29:45 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44782 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbfKOF3n (ORCPT ); Fri, 15 Nov 2019 00:29:43 -0500 Received: by mail-pg1-f195.google.com with SMTP id f19so5250527pgk.11 for ; Thu, 14 Nov 2019 21:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3eyfb2OrYp8TsjvCHWGOdjzVViIx7fXj54769KBwJJs=; b=WLeVC+bb8Vrvf4vKteqU9C4j8gcyE3iSyPw9jK9cLJYGDNB48w+YDoKaKJ/GyKEt5S l3MxXC62rmd5XIK70+R5/HdgKeeuY9MwDSV7DmHCrdO0mOXPGCnP8jDMr/kY6zS3diXm in0pIWoDHXA0+Ip7P2KU71+CSG6aTxgDKuzH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3eyfb2OrYp8TsjvCHWGOdjzVViIx7fXj54769KBwJJs=; b=d9aJeSBjKaIx8atgmFLo8gH56COvNJdNhMyqfnuK6LBCWefT6d+Ssk7Q5HtALr00Ur f1C26Rd0NwH8lvYWxOURi+GirImjMr2YpVKJldf9kMBOYu8EMnqxsqIaPKcvgUWPND4U iic6Fka/yLvbOWx6STVAKuxQ5jMKj6DIGwg+xhuVx3CEvd6qPDwCZKQ4YRXzXf7bX+IB 0yZbXlyEeydARnWk4cvShTPCAvrrAuF3y/qFVb6l81+NrN/+P7NP0CtyMatnY+DiwQ1h vGS4SLyqZwYv3HSUOG/TnI5JDY3fyb5zGDSqK6zIsNuoTfr79wCwAUeaJ/ARW+Bsozut tBVQ== X-Gm-Message-State: APjAAAVH9H3l48bmXPBxCdU5lsFT5qMJYhrscXyJuFrLBVecjSmvUWQK DBhFVRkiG5aD+BGMYtohcbAyTw== X-Google-Smtp-Source: APXvYqxg3RbCCP64BlhX6E+DM8vGwVDnsAvQCshvC9SlNLNCZXX7IVJO1WQAF7/MaqE4yCjC5KCYBQ== X-Received: by 2002:a17:90a:62c4:: with SMTP id k4mr2703427pjs.0.1573795782880; Thu, 14 Nov 2019 21:29:42 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x192sm10581104pfd.96.2019.11.14.21.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 21:29:38 -0800 (PST) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , Ariel Elior , Sudarsana Kalluru , GR-everest-linux-l2@marvell.com, Sami Tolvanen , netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] bnx2x: Drop redundant callback function casts Date: Thu, 14 Nov 2019 21:07:11 -0800 Message-Id: <20191115050715.6247-2-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191115050715.6247-1-keescook@chromium.org> References: <20191115050715.6247-1-keescook@chromium.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org NULL is already "void *" so it will auto-cast in assignments and initializers. Additionally, all the callbacks for .link_reset, .config_loopback, .set_link_led, and .phy_specific_func are already correct. No casting is needed for these, so remove them. Signed-off-by: Kees Cook --- .../net/ethernet/broadcom/bnx2x/bnx2x_link.c | 160 +++++++++--------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index d581d0ae6584..decde193c5b3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c @@ -11636,14 +11636,14 @@ static const struct bnx2x_phy phy_null = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)NULL, - .read_status = (read_status_t)NULL, - .link_reset = (link_reset_t)NULL, - .config_loopback = (config_loopback_t)NULL, - .format_fw_ver = (format_fw_ver_t)NULL, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)NULL + .config_init = NULL, + .read_status = NULL, + .link_reset = NULL, + .config_loopback = NULL, + .format_fw_ver = NULL, + .hw_reset = NULL, + .set_link_led = NULL, + .phy_specific_func = NULL }; static const struct bnx2x_phy phy_serdes = { @@ -11673,12 +11673,12 @@ static const struct bnx2x_phy phy_serdes = { .rsrv = 0, .config_init = (config_init_t)bnx2x_xgxs_config_init, .read_status = (read_status_t)bnx2x_link_settings_status, - .link_reset = (link_reset_t)bnx2x_int_link_reset, - .config_loopback = (config_loopback_t)NULL, - .format_fw_ver = (format_fw_ver_t)NULL, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)NULL + .link_reset = bnx2x_int_link_reset, + .config_loopback = NULL, + .format_fw_ver = NULL, + .hw_reset = NULL, + .set_link_led = NULL, + .phy_specific_func = NULL }; static const struct bnx2x_phy phy_xgxs = { @@ -11709,12 +11709,12 @@ static const struct bnx2x_phy phy_xgxs = { .rsrv = 0, .config_init = (config_init_t)bnx2x_xgxs_config_init, .read_status = (read_status_t)bnx2x_link_settings_status, - .link_reset = (link_reset_t)bnx2x_int_link_reset, - .config_loopback = (config_loopback_t)bnx2x_set_xgxs_loopback, - .format_fw_ver = (format_fw_ver_t)NULL, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)bnx2x_xgxs_specific_func + .link_reset = bnx2x_int_link_reset, + .config_loopback = bnx2x_set_xgxs_loopback, + .format_fw_ver = NULL, + .hw_reset = NULL, + .set_link_led = NULL, + .phy_specific_func = bnx2x_xgxs_specific_func }; static const struct bnx2x_phy phy_warpcore = { .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, @@ -11747,12 +11747,12 @@ static const struct bnx2x_phy phy_warpcore = { /* rsrv = */0, .config_init = (config_init_t)bnx2x_warpcore_config_init, .read_status = (read_status_t)bnx2x_warpcore_read_status, - .link_reset = (link_reset_t)bnx2x_warpcore_link_reset, - .config_loopback = (config_loopback_t)bnx2x_set_warpcore_loopback, - .format_fw_ver = (format_fw_ver_t)NULL, + .link_reset = bnx2x_warpcore_link_reset, + .config_loopback = bnx2x_set_warpcore_loopback, + .format_fw_ver = NULL, .hw_reset = (hw_reset_t)bnx2x_warpcore_hw_reset, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)NULL + .set_link_led = NULL, + .phy_specific_func = NULL }; @@ -11778,12 +11778,12 @@ static const struct bnx2x_phy phy_7101 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_7101_config_init, .read_status = (read_status_t)bnx2x_7101_read_status, - .link_reset = (link_reset_t)bnx2x_common_ext_link_reset, - .config_loopback = (config_loopback_t)bnx2x_7101_config_loopback, + .link_reset = bnx2x_common_ext_link_reset, + .config_loopback = bnx2x_7101_config_loopback, .format_fw_ver = (format_fw_ver_t)bnx2x_7101_format_ver, .hw_reset = (hw_reset_t)bnx2x_7101_hw_reset, - .set_link_led = (set_link_led_t)bnx2x_7101_set_link_led, - .phy_specific_func = (phy_specific_func_t)NULL + .set_link_led = bnx2x_7101_set_link_led, + .phy_specific_func = NULL }; static const struct bnx2x_phy phy_8073 = { .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073, @@ -11809,12 +11809,12 @@ static const struct bnx2x_phy phy_8073 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_8073_config_init, .read_status = (read_status_t)bnx2x_8073_read_status, - .link_reset = (link_reset_t)bnx2x_8073_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_8073_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)bnx2x_8073_specific_func + .hw_reset = NULL, + .set_link_led = NULL, + .phy_specific_func = bnx2x_8073_specific_func }; static const struct bnx2x_phy phy_8705 = { .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705, @@ -11837,12 +11837,12 @@ static const struct bnx2x_phy phy_8705 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_8705_config_init, .read_status = (read_status_t)bnx2x_8705_read_status, - .link_reset = (link_reset_t)bnx2x_common_ext_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_common_ext_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_null_format_ver, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)NULL + .hw_reset = NULL, + .set_link_led = NULL, + .phy_specific_func = NULL }; static const struct bnx2x_phy phy_8706 = { .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706, @@ -11866,12 +11866,12 @@ static const struct bnx2x_phy phy_8706 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_8706_config_init, .read_status = (read_status_t)bnx2x_8706_read_status, - .link_reset = (link_reset_t)bnx2x_common_ext_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_common_ext_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)NULL + .hw_reset = NULL, + .set_link_led = NULL, + .phy_specific_func = NULL }; static const struct bnx2x_phy phy_8726 = { @@ -11898,12 +11898,12 @@ static const struct bnx2x_phy phy_8726 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_8726_config_init, .read_status = (read_status_t)bnx2x_8726_read_status, - .link_reset = (link_reset_t)bnx2x_8726_link_reset, - .config_loopback = (config_loopback_t)bnx2x_8726_config_loopback, + .link_reset = bnx2x_8726_link_reset, + .config_loopback = bnx2x_8726_config_loopback, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)NULL, - .phy_specific_func = (phy_specific_func_t)NULL + .hw_reset = NULL, + .set_link_led = NULL, + .phy_specific_func = NULL }; static const struct bnx2x_phy phy_8727 = { @@ -11929,12 +11929,12 @@ static const struct bnx2x_phy phy_8727 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_8727_config_init, .read_status = (read_status_t)bnx2x_8727_read_status, - .link_reset = (link_reset_t)bnx2x_8727_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_8727_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, .hw_reset = (hw_reset_t)bnx2x_8727_hw_reset, - .set_link_led = (set_link_led_t)bnx2x_8727_set_link_led, - .phy_specific_func = (phy_specific_func_t)bnx2x_8727_specific_func + .set_link_led = bnx2x_8727_set_link_led, + .phy_specific_func = bnx2x_8727_specific_func }; static const struct bnx2x_phy phy_8481 = { .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, @@ -11964,12 +11964,12 @@ static const struct bnx2x_phy phy_8481 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_8481_config_init, .read_status = (read_status_t)bnx2x_848xx_read_status, - .link_reset = (link_reset_t)bnx2x_8481_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_8481_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, .hw_reset = (hw_reset_t)bnx2x_8481_hw_reset, - .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, - .phy_specific_func = (phy_specific_func_t)NULL + .set_link_led = bnx2x_848xx_set_link_led, + .phy_specific_func = NULL }; static const struct bnx2x_phy phy_84823 = { @@ -12001,12 +12001,12 @@ static const struct bnx2x_phy phy_84823 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, .read_status = (read_status_t)bnx2x_848xx_read_status, - .link_reset = (link_reset_t)bnx2x_848x3_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_848x3_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, - .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func + .hw_reset = NULL, + .set_link_led = bnx2x_848xx_set_link_led, + .phy_specific_func = bnx2x_848xx_specific_func }; static const struct bnx2x_phy phy_84833 = { @@ -12036,12 +12036,12 @@ static const struct bnx2x_phy phy_84833 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, .read_status = (read_status_t)bnx2x_848xx_read_status, - .link_reset = (link_reset_t)bnx2x_848x3_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_848x3_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, - .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, - .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func + .set_link_led = bnx2x_848xx_set_link_led, + .phy_specific_func = bnx2x_848xx_specific_func }; static const struct bnx2x_phy phy_84834 = { @@ -12070,12 +12070,12 @@ static const struct bnx2x_phy phy_84834 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, .read_status = (read_status_t)bnx2x_848xx_read_status, - .link_reset = (link_reset_t)bnx2x_848x3_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_848x3_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, - .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, - .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func + .set_link_led = bnx2x_848xx_set_link_led, + .phy_specific_func = bnx2x_848xx_specific_func }; static const struct bnx2x_phy phy_84858 = { @@ -12104,12 +12104,12 @@ static const struct bnx2x_phy phy_84858 = { .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, .read_status = (read_status_t)bnx2x_848xx_read_status, - .link_reset = (link_reset_t)bnx2x_848x3_link_reset, - .config_loopback = (config_loopback_t)NULL, + .link_reset = bnx2x_848x3_link_reset, + .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_8485x_format_ver, .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, - .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, - .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func + .set_link_led = bnx2x_848xx_set_link_led, + .phy_specific_func = bnx2x_848xx_specific_func }; static const struct bnx2x_phy phy_54618se = { @@ -12138,12 +12138,12 @@ static const struct bnx2x_phy phy_54618se = { /* rsrv = */0, .config_init = (config_init_t)bnx2x_54618se_config_init, .read_status = (read_status_t)bnx2x_54618se_read_status, - .link_reset = (link_reset_t)bnx2x_54618se_link_reset, - .config_loopback = (config_loopback_t)bnx2x_54618se_config_loopback, - .format_fw_ver = (format_fw_ver_t)NULL, - .hw_reset = (hw_reset_t)NULL, - .set_link_led = (set_link_led_t)bnx2x_5461x_set_link_led, - .phy_specific_func = (phy_specific_func_t)bnx2x_54618se_specific_func + .link_reset = bnx2x_54618se_link_reset, + .config_loopback = bnx2x_54618se_config_loopback, + .format_fw_ver = NULL, + .hw_reset = NULL, + .set_link_led = bnx2x_5461x_set_link_led, + .phy_specific_func = bnx2x_54618se_specific_func }; /*****************************************************************/ /* */ From patchwork Fri Nov 15 05:07:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1195353 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="S2TBHmiX"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47Dn4C1jjKz9sPJ for ; Fri, 15 Nov 2019 16:30:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727376AbfKOFaS (ORCPT ); Fri, 15 Nov 2019 00:30:18 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37485 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727041AbfKOF3m (ORCPT ); Fri, 15 Nov 2019 00:29:42 -0500 Received: by mail-pg1-f194.google.com with SMTP id z24so5276217pgu.4 for ; Thu, 14 Nov 2019 21:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZchL8g0OYzmNZ1oDXGo2WqPGV2bdTUUMyrmDfLdFGw8=; b=S2TBHmiXjhSKr2HK3f+nMKOREnXuVHS0voav4IxRqoek1aPRK+Qhc5hnB3ZR1Z9jor i4YvAZV4B4RxlZqQqrDhmvmEY2fBmgRsYjTgifoW5Loy0IzEpkX5ZbVWN017OeFnQtB5 AfhBVQoc7MsiOj6lHhUYiTM38WPAOXjlfzznA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZchL8g0OYzmNZ1oDXGo2WqPGV2bdTUUMyrmDfLdFGw8=; b=nWFQ6MGFqDMNa9vFR/5A56nAPrj91Wa/e7XxsOpUb1Ksi/EgT5CEj6sOiWudv7Vz/C rLO95reQH/5sd/gKyemaTVSf1MoC12ElZaYgacya1FsYbK/X7i0e5MZRmhDbS0gJ9VHd I/lMqH3CpIjHaJolbJfnXKCGIUP9f5PcNCT9vMLepRdHgCBKUKoaTnFPfCajeONcMAje BmgzoAen4ix3tW4Qwj6h0f5+KbVPy3nyHCIz7A5WFlWnEiYcIZshZdMfs17nr3i9F0m0 NqankmL4hqnje68CCRB/CV6z+kvuGNi7ElI1kewJg+lpG08Y1yUQ/01nH9rHtoGn/igk BzUw== X-Gm-Message-State: APjAAAUN7Z5rQzq6WUBQlWBRe90WkbBei5Wg/LivpI2GbiZlGXdL5VWf BRDlKAIZr9G4SxG9EaH8PIvy0Q== X-Google-Smtp-Source: APXvYqxSkmTUYM8d2QJ9A2A5kmvLinYimI02VllIF2GhtID9UfB1dkaLDWXW234Pk6SvPinztoX6hA== X-Received: by 2002:a17:90a:a40f:: with SMTP id y15mr17680436pjp.106.1573795781824; Thu, 14 Nov 2019 21:29:41 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r68sm9298940pfr.78.2019.11.14.21.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 21:29:38 -0800 (PST) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , Ariel Elior , Sudarsana Kalluru , GR-everest-linux-l2@marvell.com, Sami Tolvanen , netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] bnx2x: Remove read_status_t function casts Date: Thu, 14 Nov 2019 21:07:12 -0800 Message-Id: <20191115050715.6247-3-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191115050715.6247-1-keescook@chromium.org> References: <20191115050715.6247-1-keescook@chromium.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The function casts for .read_status callbacks end up casting some int return values to u8. This seems to be bug-prone (-EINVAL being returned into something that appears to be true/false), but fixing the function prototypes doesn't change the existing behavior. Fix the return values to remove the casts. Signed-off-by: Kees Cook --- .../net/ethernet/broadcom/bnx2x/bnx2x_link.c | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index decde193c5b3..a124f1e0819f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c @@ -5611,9 +5611,9 @@ static int bnx2x_get_link_speed_duplex(struct bnx2x_phy *phy, return 0; } -static int bnx2x_link_settings_status(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static u8 bnx2x_link_settings_status(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { struct bnx2x *bp = params->bp; @@ -5685,7 +5685,7 @@ static int bnx2x_link_settings_status(struct bnx2x_phy *phy, return rc; } -static int bnx2x_warpcore_read_status(struct bnx2x_phy *phy, +static u8 bnx2x_warpcore_read_status(struct bnx2x_phy *phy, struct link_params *params, struct link_vars *vars) { @@ -8993,9 +8993,9 @@ static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy, return 0; } -static int bnx2x_8706_read_status(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static u8 bnx2x_8706_read_status(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { return bnx2x_8706_8726_read_status(phy, params, vars); } @@ -11672,7 +11672,7 @@ static const struct bnx2x_phy phy_serdes = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_xgxs_config_init, - .read_status = (read_status_t)bnx2x_link_settings_status, + .read_status = bnx2x_link_settings_status, .link_reset = bnx2x_int_link_reset, .config_loopback = NULL, .format_fw_ver = NULL, @@ -11708,7 +11708,7 @@ static const struct bnx2x_phy phy_xgxs = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_xgxs_config_init, - .read_status = (read_status_t)bnx2x_link_settings_status, + .read_status = bnx2x_link_settings_status, .link_reset = bnx2x_int_link_reset, .config_loopback = bnx2x_set_xgxs_loopback, .format_fw_ver = NULL, @@ -11746,7 +11746,7 @@ static const struct bnx2x_phy phy_warpcore = { /* req_duplex = */0, /* rsrv = */0, .config_init = (config_init_t)bnx2x_warpcore_config_init, - .read_status = (read_status_t)bnx2x_warpcore_read_status, + .read_status = bnx2x_warpcore_read_status, .link_reset = bnx2x_warpcore_link_reset, .config_loopback = bnx2x_set_warpcore_loopback, .format_fw_ver = NULL, @@ -11777,7 +11777,7 @@ static const struct bnx2x_phy phy_7101 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_7101_config_init, - .read_status = (read_status_t)bnx2x_7101_read_status, + .read_status = bnx2x_7101_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = bnx2x_7101_config_loopback, .format_fw_ver = (format_fw_ver_t)bnx2x_7101_format_ver, @@ -11808,7 +11808,7 @@ static const struct bnx2x_phy phy_8073 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_8073_config_init, - .read_status = (read_status_t)bnx2x_8073_read_status, + .read_status = bnx2x_8073_read_status, .link_reset = bnx2x_8073_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, @@ -11836,7 +11836,7 @@ static const struct bnx2x_phy phy_8705 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_8705_config_init, - .read_status = (read_status_t)bnx2x_8705_read_status, + .read_status = bnx2x_8705_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_null_format_ver, @@ -11865,7 +11865,7 @@ static const struct bnx2x_phy phy_8706 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_8706_config_init, - .read_status = (read_status_t)bnx2x_8706_read_status, + .read_status = bnx2x_8706_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, @@ -11897,7 +11897,7 @@ static const struct bnx2x_phy phy_8726 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_8726_config_init, - .read_status = (read_status_t)bnx2x_8726_read_status, + .read_status = bnx2x_8726_read_status, .link_reset = bnx2x_8726_link_reset, .config_loopback = bnx2x_8726_config_loopback, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, @@ -11928,7 +11928,7 @@ static const struct bnx2x_phy phy_8727 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_8727_config_init, - .read_status = (read_status_t)bnx2x_8727_read_status, + .read_status = bnx2x_8727_read_status, .link_reset = bnx2x_8727_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, @@ -11963,7 +11963,7 @@ static const struct bnx2x_phy phy_8481 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_8481_config_init, - .read_status = (read_status_t)bnx2x_848xx_read_status, + .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_8481_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, @@ -12000,7 +12000,7 @@ static const struct bnx2x_phy phy_84823 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, - .read_status = (read_status_t)bnx2x_848xx_read_status, + .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, @@ -12035,7 +12035,7 @@ static const struct bnx2x_phy phy_84833 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, - .read_status = (read_status_t)bnx2x_848xx_read_status, + .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, @@ -12069,7 +12069,7 @@ static const struct bnx2x_phy phy_84834 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, - .read_status = (read_status_t)bnx2x_848xx_read_status, + .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, @@ -12103,7 +12103,7 @@ static const struct bnx2x_phy phy_84858 = { .req_duplex = 0, .rsrv = 0, .config_init = (config_init_t)bnx2x_848x3_config_init, - .read_status = (read_status_t)bnx2x_848xx_read_status, + .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, .format_fw_ver = (format_fw_ver_t)bnx2x_8485x_format_ver, @@ -12137,7 +12137,7 @@ static const struct bnx2x_phy phy_54618se = { /* req_duplex = */0, /* rsrv = */0, .config_init = (config_init_t)bnx2x_54618se_config_init, - .read_status = (read_status_t)bnx2x_54618se_read_status, + .read_status = bnx2x_54618se_read_status, .link_reset = bnx2x_54618se_link_reset, .config_loopback = bnx2x_54618se_config_loopback, .format_fw_ver = NULL, From patchwork Fri Nov 15 05:07:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1195352 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="P8s4lKr1"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47Dn403s3Yz9sPK for ; Fri, 15 Nov 2019 16:30:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbfKOFaH (ORCPT ); Fri, 15 Nov 2019 00:30:07 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33682 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727077AbfKOF3n (ORCPT ); Fri, 15 Nov 2019 00:29:43 -0500 Received: by mail-pf1-f194.google.com with SMTP id c184so5875738pfb.0 for ; Thu, 14 Nov 2019 21:29:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YDYkBjkBbQkNa38peIYhjMIM9N8dktFnNdPZLlA0nKk=; b=P8s4lKr1FHUjSOA9qtcrBCw2j3pk9mrJbqYVOeH0lHfzfxEcg/qwJO1S7hpheqZ5o/ CQGjps6xVqlJG8S1WVRn/Ir3zTgaEAtWufvcp4IoRKLt76DzEerDAOeQwHXfMa8/2vM6 j8wbeNHMrvl4sVFspE6fRs3XCVG5xwfhJ6vn4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YDYkBjkBbQkNa38peIYhjMIM9N8dktFnNdPZLlA0nKk=; b=OEnHIkuDHaihiu13CCoTWQMy7kIhB1d8oJiRT2gDavyotr2UPo3XniiI/IOpu5rlyx bMFW1SSEFeCgmsHA5JhYDKxYb1D/N8ZWusD6sIDkcm1Ym8H+rp6/7erIrn0ILybyF0Av fBGusJKlzpBSpXFhCWVdGMTFHMGvkaenuFDN4zQ0U0jXSDvWz2l2XpEiCUy7bdSN1xV1 J32lJYgZ/M3CykjHR//ok9PsMNKfyEIP1cJeCAcJWx81LY9WNDUclU/JJTTengPWumck Bn+7ZI89Zakk97g9IJJN9nAOnhLt7AKGs9pbT3UDJmvwCIQLprWWAhkOrfHL+Zczh04s fbmg== X-Gm-Message-State: APjAAAXOF0931DXYTeqYSntl5Vu/9YCtdB+paOPVlxgNhOMqezRVCmqD B4LuJeJMfxm3Not7a8X82R5JRg== X-Google-Smtp-Source: APXvYqx49Q0Jm9xTH248nnIbpLRKsCPTF72sZcIdUnH9MX89f02/Kw+ZPyG/obFrenhJVQUQvldPOw== X-Received: by 2002:a63:3f4e:: with SMTP id m75mr5090958pga.392.1573795780689; Thu, 14 Nov 2019 21:29:40 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w7sm9330792pfb.101.2019.11.14.21.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 21:29:38 -0800 (PST) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , Ariel Elior , Sudarsana Kalluru , GR-everest-linux-l2@marvell.com, Sami Tolvanen , netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] bnx2x: Remove config_init_t function casts Date: Thu, 14 Nov 2019 21:07:13 -0800 Message-Id: <20191115050715.6247-4-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191115050715.6247-1-keescook@chromium.org> References: <20191115050715.6247-1-keescook@chromium.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org No callers of .config_init check return values. Remove the casting and change all callbacks to have the correct function prototype. Signed-off-by: Kees Cook --- .../net/ethernet/broadcom/bnx2x/bnx2x_link.c | 105 ++++++++---------- .../net/ethernet/broadcom/bnx2x/bnx2x_link.h | 4 +- 2 files changed, 48 insertions(+), 61 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index a124f1e0819f..2bc6408ce00d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c @@ -7364,9 +7364,9 @@ static void bnx2x_8073_specific_func(struct bnx2x_phy *phy, } } -static int bnx2x_8073_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_8073_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { struct bnx2x *bp = params->bp; u16 val = 0, tmp1; @@ -7427,7 +7427,7 @@ static int bnx2x_8073_config_init(struct bnx2x_phy *phy, if (params->loopback_mode == LOOPBACK_EXT) { bnx2x_807x_force_10G(bp, phy); DP(NETIF_MSG_LINK, "Forced speed 10G on 807X\n"); - return 0; + return; } else { bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_BCM_CTRL, 0x0002); @@ -7509,7 +7509,6 @@ static int bnx2x_8073_config_init(struct bnx2x_phy *phy, bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0x1200); DP(NETIF_MSG_LINK, "807x Autoneg Restart: Advertise 1G=%x, 10G=%x\n", ((val & (1<<5)) > 0), ((val & (1<<7)) > 0)); - return 0; } static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, @@ -7676,9 +7675,9 @@ static void bnx2x_8073_link_reset(struct bnx2x_phy *phy, /******************************************************************/ /* BCM8705 PHY SECTION */ /******************************************************************/ -static int bnx2x_8705_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_8705_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { struct bnx2x *bp = params->bp; DP(NETIF_MSG_LINK, "init 8705\n"); @@ -7700,7 +7699,6 @@ static int bnx2x_8705_config_init(struct bnx2x_phy *phy, MDIO_WIS_DEVAD, MDIO_WIS_REG_LASI_CNTL, 0x1); /* BCM8705 doesn't have microcode, hence the 0 */ bnx2x_save_spirom_version(bp, params->port, params->shmem_base, 0); - return 0; } static u8 bnx2x_8705_read_status(struct bnx2x_phy *phy, @@ -8887,9 +8885,9 @@ static u8 bnx2x_8706_8726_read_status(struct bnx2x_phy *phy, /******************************************************************/ /* BCM8706 PHY SECTION */ /******************************************************************/ -static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_8706_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { u32 tx_en_mode; u16 cnt, val, tmp1; @@ -8989,8 +8987,6 @@ static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy, bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_DIGITAL_CTRL, tmp1); } - - return 0; } static u8 bnx2x_8706_read_status(struct bnx2x_phy *phy, @@ -9070,9 +9066,9 @@ static u8 bnx2x_8726_read_status(struct bnx2x_phy *phy, } -static int bnx2x_8726_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_8726_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { struct bnx2x *bp = params->bp; DP(NETIF_MSG_LINK, "Initializing BCM8726\n"); @@ -9150,9 +9146,6 @@ static int bnx2x_8726_config_init(struct bnx2x_phy *phy, MDIO_PMA_REG_8726_TX_CTRL2, phy->tx_preemphasis[1]); } - - return 0; - } static void bnx2x_8726_link_reset(struct bnx2x_phy *phy, @@ -9288,9 +9281,9 @@ static void bnx2x_8727_config_speed(struct bnx2x_phy *phy, } } -static int bnx2x_8727_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_8727_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { u32 tx_en_mode; u16 tmp1, mod_abs, tmp2; @@ -9370,8 +9363,6 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, (tmp2 & 0x7fff)); } - - return 0; } static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, @@ -9946,9 +9937,9 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, return 0; } -static int bnx2x_8481_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_8481_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { struct bnx2x *bp = params->bp; /* Restore normal power mode*/ @@ -9960,7 +9951,7 @@ static int bnx2x_8481_config_init(struct bnx2x_phy *phy, bnx2x_wait_reset_complete(bp, phy, params); bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); - return bnx2x_848xx_cmn_config_init(phy, params, vars); + bnx2x_848xx_cmn_config_init(phy, params, vars); } #define PHY848xx_CMDHDLR_WAIT 300 @@ -10283,9 +10274,9 @@ static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy, } #define PHY84833_CONSTANT_LATENCY 1193 -static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_848x3_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { struct bnx2x *bp = params->bp; u8 port, initialize = 1; @@ -10430,7 +10421,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, if (rc) { DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n"); bnx2x_8483x_disable_eee(phy, params, vars); - return rc; + return; } if ((phy->req_duplex == DUPLEX_FULL) && @@ -10442,7 +10433,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, rc = bnx2x_8483x_disable_eee(phy, params, vars); if (rc) { DP(NETIF_MSG_LINK, "Failed to set EEE advertisement\n"); - return rc; + return; } } else { vars->eee_status &= ~SHMEM_EEE_SUPPORTED_MASK; @@ -10481,7 +10472,6 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, MDIO_84833_TOP_CFG_XGPHY_STRAP1, (u16)~MDIO_84833_SUPER_ISOLATE); } - return rc; } static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, @@ -11038,9 +11028,9 @@ static void bnx2x_54618se_specific_func(struct bnx2x_phy *phy, } } -static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_54618se_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { struct bnx2x *bp = params->bp; u8 port; @@ -11240,8 +11230,6 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, bnx2x_cl22_write(bp, phy, MDIO_PMA_REG_CTRL, autoneg_val); - - return 0; } @@ -11465,9 +11453,9 @@ static void bnx2x_7101_config_loopback(struct bnx2x_phy *phy, MDIO_XS_DEVAD, MDIO_XS_SFX7101_XGXS_TEST1, 0x100); } -static int bnx2x_7101_config_init(struct bnx2x_phy *phy, - struct link_params *params, - struct link_vars *vars) +static void bnx2x_7101_config_init(struct bnx2x_phy *phy, + struct link_params *params, + struct link_vars *vars) { u16 fw_ver1, fw_ver2, val; struct bnx2x *bp = params->bp; @@ -11502,7 +11490,6 @@ static int bnx2x_7101_config_init(struct bnx2x_phy *phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_7101_VER2, &fw_ver2); bnx2x_save_spirom_version(bp, params->port, (u32)(fw_ver1<<16 | fw_ver2), phy->ver_addr); - return 0; } static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy, @@ -11671,7 +11658,7 @@ static const struct bnx2x_phy phy_serdes = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_xgxs_config_init, + .config_init = bnx2x_xgxs_config_init, .read_status = bnx2x_link_settings_status, .link_reset = bnx2x_int_link_reset, .config_loopback = NULL, @@ -11707,7 +11694,7 @@ static const struct bnx2x_phy phy_xgxs = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_xgxs_config_init, + .config_init = bnx2x_xgxs_config_init, .read_status = bnx2x_link_settings_status, .link_reset = bnx2x_int_link_reset, .config_loopback = bnx2x_set_xgxs_loopback, @@ -11745,7 +11732,7 @@ static const struct bnx2x_phy phy_warpcore = { .speed_cap_mask = 0, /* req_duplex = */0, /* rsrv = */0, - .config_init = (config_init_t)bnx2x_warpcore_config_init, + .config_init = bnx2x_warpcore_config_init, .read_status = bnx2x_warpcore_read_status, .link_reset = bnx2x_warpcore_link_reset, .config_loopback = bnx2x_set_warpcore_loopback, @@ -11776,7 +11763,7 @@ static const struct bnx2x_phy phy_7101 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_7101_config_init, + .config_init = bnx2x_7101_config_init, .read_status = bnx2x_7101_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = bnx2x_7101_config_loopback, @@ -11807,7 +11794,7 @@ static const struct bnx2x_phy phy_8073 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_8073_config_init, + .config_init = bnx2x_8073_config_init, .read_status = bnx2x_8073_read_status, .link_reset = bnx2x_8073_link_reset, .config_loopback = NULL, @@ -11835,7 +11822,7 @@ static const struct bnx2x_phy phy_8705 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_8705_config_init, + .config_init = bnx2x_8705_config_init, .read_status = bnx2x_8705_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = NULL, @@ -11864,7 +11851,7 @@ static const struct bnx2x_phy phy_8706 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_8706_config_init, + .config_init = bnx2x_8706_config_init, .read_status = bnx2x_8706_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = NULL, @@ -11896,7 +11883,7 @@ static const struct bnx2x_phy phy_8726 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_8726_config_init, + .config_init = bnx2x_8726_config_init, .read_status = bnx2x_8726_read_status, .link_reset = bnx2x_8726_link_reset, .config_loopback = bnx2x_8726_config_loopback, @@ -11927,7 +11914,7 @@ static const struct bnx2x_phy phy_8727 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_8727_config_init, + .config_init = bnx2x_8727_config_init, .read_status = bnx2x_8727_read_status, .link_reset = bnx2x_8727_link_reset, .config_loopback = NULL, @@ -11962,7 +11949,7 @@ static const struct bnx2x_phy phy_8481 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_8481_config_init, + .config_init = bnx2x_8481_config_init, .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_8481_link_reset, .config_loopback = NULL, @@ -11999,7 +11986,7 @@ static const struct bnx2x_phy phy_84823 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_848x3_config_init, + .config_init = bnx2x_848x3_config_init, .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, @@ -12034,7 +12021,7 @@ static const struct bnx2x_phy phy_84833 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_848x3_config_init, + .config_init = bnx2x_848x3_config_init, .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, @@ -12068,7 +12055,7 @@ static const struct bnx2x_phy phy_84834 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_848x3_config_init, + .config_init = bnx2x_848x3_config_init, .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, @@ -12102,7 +12089,7 @@ static const struct bnx2x_phy phy_84858 = { .speed_cap_mask = 0, .req_duplex = 0, .rsrv = 0, - .config_init = (config_init_t)bnx2x_848x3_config_init, + .config_init = bnx2x_848x3_config_init, .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, @@ -12136,7 +12123,7 @@ static const struct bnx2x_phy phy_54618se = { .speed_cap_mask = 0, /* req_duplex = */0, /* rsrv = */0, - .config_init = (config_init_t)bnx2x_54618se_config_init, + .config_init = bnx2x_54618se_config_init, .read_status = bnx2x_54618se_read_status, .link_reset = bnx2x_54618se_link_reset, .config_loopback = bnx2x_54618se_config_loopback, diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h index 7115f5025664..d31d15c78a17 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h @@ -127,8 +127,8 @@ struct link_vars; struct link_params; struct bnx2x_phy; -typedef u8 (*config_init_t)(struct bnx2x_phy *phy, struct link_params *params, - struct link_vars *vars); +typedef void (*config_init_t)(struct bnx2x_phy *phy, struct link_params *params, + struct link_vars *vars); typedef u8 (*read_status_t)(struct bnx2x_phy *phy, struct link_params *params, struct link_vars *vars); typedef void (*link_reset_t)(struct bnx2x_phy *phy, From patchwork Fri Nov 15 05:07:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1195350 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Gf4KiRVk"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47Dn3r3Q3nz9sPW for ; Fri, 15 Nov 2019 16:30:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbfKOF37 (ORCPT ); Fri, 15 Nov 2019 00:29:59 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41863 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbfKOF3q (ORCPT ); Fri, 15 Nov 2019 00:29:46 -0500 Received: by mail-pg1-f196.google.com with SMTP id h4so5255487pgv.8 for ; Thu, 14 Nov 2019 21:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CUnOECriyCGPMUs77nJPQe7W5fpmBDeLqmFUMqLQ4ns=; b=Gf4KiRVkt5957A/5n6CMLoowxR8z89RL/D0JR0F6914IPtMblpAY4h5Xoi9sdMp3/E mISlvAOtrAE+Wx+DOFWewx7Vc/MHnH7dcYrwhGCUKGBdejf3nj9TgYxOoQ2Le92rls14 //g9j6jhqKm04JhOvkLBp2rT6njmcbRAPBs7s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CUnOECriyCGPMUs77nJPQe7W5fpmBDeLqmFUMqLQ4ns=; b=VKIosnPOQ5fyjaIz46rHs9BiatDrZD30q1P3G9id+faglz81qLrez9PmNgnPHOPgxw fPP+vFz3X206YrKhgo6J+PzTOzeaJf62DxaP+mR/KDQUN2g7Mr8GOBIjRv0uEU3Y6dju s8xI8gqF9UrSqTwtwh9UXRGTW8VIi98+VVi0ipWWzXEqvuq/sfTJp/HCoEzYN9O3NRGu WUbxkms0q6+nHpLwYpHgiy8KIxQ2JONf6ZCbJvbhUyHYte+LKDSLoRGoy/Rfhh+sTooW GJlNqW1wE3SR/21egmbuTIXYVog5XQHFmwhdiXXrhR85JAkToCcgz6c/xABJHjGroSM2 Upgw== X-Gm-Message-State: APjAAAXfYC543HNHbPghM6vKa8fVGaqmcWMzlph9CKBVf0pall+vkqQG V1JFphcXllOM1jyTXc9Or4ivIQ== X-Google-Smtp-Source: APXvYqxCchciC7RO/ge8MF6qR0zrw7E75p61yGCLl/oKfJf8e1BMGrQHsuVEhe+hQi9MUpPZRZKyEw== X-Received: by 2002:a63:ca05:: with SMTP id n5mr14155578pgi.187.1573795785766; Thu, 14 Nov 2019 21:29:45 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w6sm661086pge.92.2019.11.14.21.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 21:29:42 -0800 (PST) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , Ariel Elior , Sudarsana Kalluru , GR-everest-linux-l2@marvell.com, Sami Tolvanen , netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] bnx2x: Remove format_fw_ver_t function casts Date: Thu, 14 Nov 2019 21:07:14 -0800 Message-Id: <20191115050715.6247-5-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191115050715.6247-1-keescook@chromium.org> References: <20191115050715.6247-1-keescook@chromium.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The return values for format_fw_ver_t callbacks are supposed to be "int", not "u8". Ultimately, the top-level caller doesn't actually check the return value at all, but just clean this all up anyway and fix the prototypes so that casts are no longer needed. Signed-off-by: Kees Cook --- .../net/ethernet/broadcom/bnx2x/bnx2x_link.c | 22 +++++++++---------- .../net/ethernet/broadcom/bnx2x/bnx2x_link.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 2bc6408ce00d..7dd35aa75925 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c @@ -11767,7 +11767,7 @@ static const struct bnx2x_phy phy_7101 = { .read_status = bnx2x_7101_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = bnx2x_7101_config_loopback, - .format_fw_ver = (format_fw_ver_t)bnx2x_7101_format_ver, + .format_fw_ver = bnx2x_7101_format_ver, .hw_reset = (hw_reset_t)bnx2x_7101_hw_reset, .set_link_led = bnx2x_7101_set_link_led, .phy_specific_func = NULL @@ -11798,7 +11798,7 @@ static const struct bnx2x_phy phy_8073 = { .read_status = bnx2x_8073_read_status, .link_reset = bnx2x_8073_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, + .format_fw_ver = bnx2x_format_ver, .hw_reset = NULL, .set_link_led = NULL, .phy_specific_func = bnx2x_8073_specific_func @@ -11826,7 +11826,7 @@ static const struct bnx2x_phy phy_8705 = { .read_status = bnx2x_8705_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_null_format_ver, + .format_fw_ver = bnx2x_null_format_ver, .hw_reset = NULL, .set_link_led = NULL, .phy_specific_func = NULL @@ -11855,7 +11855,7 @@ static const struct bnx2x_phy phy_8706 = { .read_status = bnx2x_8706_read_status, .link_reset = bnx2x_common_ext_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, + .format_fw_ver = bnx2x_format_ver, .hw_reset = NULL, .set_link_led = NULL, .phy_specific_func = NULL @@ -11887,7 +11887,7 @@ static const struct bnx2x_phy phy_8726 = { .read_status = bnx2x_8726_read_status, .link_reset = bnx2x_8726_link_reset, .config_loopback = bnx2x_8726_config_loopback, - .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, + .format_fw_ver = bnx2x_format_ver, .hw_reset = NULL, .set_link_led = NULL, .phy_specific_func = NULL @@ -11918,7 +11918,7 @@ static const struct bnx2x_phy phy_8727 = { .read_status = bnx2x_8727_read_status, .link_reset = bnx2x_8727_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver, + .format_fw_ver = bnx2x_format_ver, .hw_reset = (hw_reset_t)bnx2x_8727_hw_reset, .set_link_led = bnx2x_8727_set_link_led, .phy_specific_func = bnx2x_8727_specific_func @@ -11953,7 +11953,7 @@ static const struct bnx2x_phy phy_8481 = { .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_8481_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, + .format_fw_ver = bnx2x_848xx_format_ver, .hw_reset = (hw_reset_t)bnx2x_8481_hw_reset, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = NULL @@ -11990,7 +11990,7 @@ static const struct bnx2x_phy phy_84823 = { .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, + .format_fw_ver = bnx2x_848xx_format_ver, .hw_reset = NULL, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = bnx2x_848xx_specific_func @@ -12025,7 +12025,7 @@ static const struct bnx2x_phy phy_84833 = { .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, + .format_fw_ver = bnx2x_848xx_format_ver, .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = bnx2x_848xx_specific_func @@ -12059,7 +12059,7 @@ static const struct bnx2x_phy phy_84834 = { .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, + .format_fw_ver = bnx2x_848xx_format_ver, .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = bnx2x_848xx_specific_func @@ -12093,7 +12093,7 @@ static const struct bnx2x_phy phy_84858 = { .read_status = bnx2x_848xx_read_status, .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, - .format_fw_ver = (format_fw_ver_t)bnx2x_8485x_format_ver, + .format_fw_ver = bnx2x_8485x_format_ver, .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = bnx2x_848xx_specific_func diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h index d31d15c78a17..cae03c89dc73 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h @@ -135,7 +135,7 @@ typedef void (*link_reset_t)(struct bnx2x_phy *phy, struct link_params *params); typedef void (*config_loopback_t)(struct bnx2x_phy *phy, struct link_params *params); -typedef u8 (*format_fw_ver_t)(u32 raw, u8 *str, u16 *len); +typedef int (*format_fw_ver_t)(u32 raw, u8 *str, u16 *len); typedef void (*hw_reset_t)(struct bnx2x_phy *phy, struct link_params *params); typedef void (*set_link_led_t)(struct bnx2x_phy *phy, struct link_params *params, u8 mode); From patchwork Fri Nov 15 05:07:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1195349 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KdyazIcV"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47Dn3q5vvSz9sPV for ; Fri, 15 Nov 2019 16:29:59 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727302AbfKOF36 (ORCPT ); Fri, 15 Nov 2019 00:29:58 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43340 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727217AbfKOF3r (ORCPT ); Fri, 15 Nov 2019 00:29:47 -0500 Received: by mail-pf1-f193.google.com with SMTP id 3so5852446pfb.10 for ; Thu, 14 Nov 2019 21:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=C9I5FqW0z8fenw97nfBVEeoAsOoFr9Mv0e0uFaFX9H0=; b=KdyazIcVt/KrZ4Q4dPukr55+0f+LWN3FdURkiejEjDxeIaipIHVsXos1gZ7NOv5oAC nBCU6ZcNEllQVcTxPM68PAW4OKdhuUVgvhoaKG9dWWFK2T3anLrxqjrWgpudcjZfD4Mh ArgbCrLslQ6DK1H1FpXuVXtZvw6Lu0L2HKHTs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=C9I5FqW0z8fenw97nfBVEeoAsOoFr9Mv0e0uFaFX9H0=; b=sWSeEqNJE+HV59PY5ihhmHCtip5NaKzOWBK2bZQwWTNpTgHSvwlfF2FmZIR5CDcXeO 91J8CXpYE2mB0oHzI8dvDQEzqLhdvbN3L6oAWQxOoe0cP6idOxh8YOJ1mgk8AI6hy/Im q/2RRKpCUKra9BVdRfZCBxgqqAS34WCqXGkw/ituTRXkH0J+7EKl99LZMXukE2ToUoGm YF/fryPe9m64uljrMxdRfTMVHGxi2wArZPErMoT5UtCh3xEWUto5I/OW13AecnmgfY4+ 772T3k7n3/SEgY2P9OEInTLpw7LFrbhJxMzdqnY5cCigbReP4FsfIpWFEDuZZdst5+VG kSrw== X-Gm-Message-State: APjAAAWLSY2LAIsYObmBdDfms3+wG3BmznGfWHrcwwfE8VksOXCq/LY4 rORXBv893dEDZSHVM2V19b/R4A== X-Google-Smtp-Source: APXvYqwc5nrGGxexFGky4nRCM5cHAELptoH7k4Z94evZphJre2euyv6XPNoAvpYGEjuz34jD3TFjNQ== X-Received: by 2002:a63:535c:: with SMTP id t28mr1441537pgl.173.1573795786355; Thu, 14 Nov 2019 21:29:46 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r33sm8438101pjb.5.2019.11.14.21.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 21:29:42 -0800 (PST) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , Ariel Elior , Sudarsana Kalluru , GR-everest-linux-l2@marvell.com, Sami Tolvanen , netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] bnx2x: Remove hw_reset_t function casts Date: Thu, 14 Nov 2019 21:07:15 -0800 Message-Id: <20191115050715.6247-6-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191115050715.6247-1-keescook@chromium.org> References: <20191115050715.6247-1-keescook@chromium.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org All .rw_reset callbacks except bnx2x_84833_hw_reset_phy() use a void return type. No callers of .hw_reset check a return value and bnx2x_84833_hw_reset_phy() unconditionally returns 0. Remove all hw_reset_t casts and fix the return type to void. Signed-off-by: Kees Cook --- .../net/ethernet/broadcom/bnx2x/bnx2x_link.c | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 7dd35aa75925..9638d65d8261 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c @@ -10201,8 +10201,8 @@ static u8 bnx2x_84833_get_reset_gpios(struct bnx2x *bp, return reset_gpios; } -static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, - struct link_params *params) +static void bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, + struct link_params *params) { struct bnx2x *bp = params->bp; u8 reset_gpios; @@ -10230,8 +10230,6 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, udelay(10); DP(NETIF_MSG_LINK, "84833 hw reset on pin values 0x%x\n", reset_gpios); - - return 0; } static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy, @@ -11737,7 +11735,7 @@ static const struct bnx2x_phy phy_warpcore = { .link_reset = bnx2x_warpcore_link_reset, .config_loopback = bnx2x_set_warpcore_loopback, .format_fw_ver = NULL, - .hw_reset = (hw_reset_t)bnx2x_warpcore_hw_reset, + .hw_reset = bnx2x_warpcore_hw_reset, .set_link_led = NULL, .phy_specific_func = NULL }; @@ -11768,7 +11766,7 @@ static const struct bnx2x_phy phy_7101 = { .link_reset = bnx2x_common_ext_link_reset, .config_loopback = bnx2x_7101_config_loopback, .format_fw_ver = bnx2x_7101_format_ver, - .hw_reset = (hw_reset_t)bnx2x_7101_hw_reset, + .hw_reset = bnx2x_7101_hw_reset, .set_link_led = bnx2x_7101_set_link_led, .phy_specific_func = NULL }; @@ -11919,7 +11917,7 @@ static const struct bnx2x_phy phy_8727 = { .link_reset = bnx2x_8727_link_reset, .config_loopback = NULL, .format_fw_ver = bnx2x_format_ver, - .hw_reset = (hw_reset_t)bnx2x_8727_hw_reset, + .hw_reset = bnx2x_8727_hw_reset, .set_link_led = bnx2x_8727_set_link_led, .phy_specific_func = bnx2x_8727_specific_func }; @@ -11954,7 +11952,7 @@ static const struct bnx2x_phy phy_8481 = { .link_reset = bnx2x_8481_link_reset, .config_loopback = NULL, .format_fw_ver = bnx2x_848xx_format_ver, - .hw_reset = (hw_reset_t)bnx2x_8481_hw_reset, + .hw_reset = bnx2x_8481_hw_reset, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = NULL }; @@ -12026,7 +12024,7 @@ static const struct bnx2x_phy phy_84833 = { .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, .format_fw_ver = bnx2x_848xx_format_ver, - .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, + .hw_reset = bnx2x_84833_hw_reset_phy, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = bnx2x_848xx_specific_func }; @@ -12060,7 +12058,7 @@ static const struct bnx2x_phy phy_84834 = { .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, .format_fw_ver = bnx2x_848xx_format_ver, - .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, + .hw_reset = bnx2x_84833_hw_reset_phy, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = bnx2x_848xx_specific_func }; @@ -12094,7 +12092,7 @@ static const struct bnx2x_phy phy_84858 = { .link_reset = bnx2x_848x3_link_reset, .config_loopback = NULL, .format_fw_ver = bnx2x_8485x_format_ver, - .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, + .hw_reset = bnx2x_84833_hw_reset_phy, .set_link_led = bnx2x_848xx_set_link_led, .phy_specific_func = bnx2x_848xx_specific_func };