Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3111240pxm; Mon, 28 Feb 2022 12:14:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX6lwHXoDd7qlrMDcmUsBh6M3F/u3P/Kg2ZVBseNjTezomSBSpSAI33O3JG+I/GDF4UZhV X-Received: by 2002:a63:6e8d:0:b0:378:a525:6ee5 with SMTP id j135-20020a636e8d000000b00378a5256ee5mr5548405pgc.9.1646079265101; Mon, 28 Feb 2022 12:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646079265; cv=none; d=google.com; s=arc-20160816; b=bvJ9J7VllYnLdRk+LjEoc1vLAu6q7txJG4JyWolfxjdjsuJWF6k0oiZnuLsMvGu+jQ JxQMpwC6mvX60O5FUCNv4cWC0Q0ICamPqr+t5g/NHkT97eZ/zIvj9QaFtgj0Gyqjtb0b HbQS9Qje58zWY6vNCRr4kzxALauY7zkku/CdiPOe+qKptYRz4tTchgV2dtLAryQTLm0l SE69y70r/B8NyRqloNJ6ahbEQFkADM0ShlWAn2XKbeGm4pdd+h2zJ99/h6UfDovqSJ0F U+3piHsX7f6DUL6KHDlLcMdf9tGHJJT826FAJP3KcBBnihAKDPIvfEQGfXm4VAAyZ7+k q/vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y0t/kW9Oundlov0+PsEoYqPj7kcI82F7LaMJaiA3uhw=; b=jbDy+xlovrbOkKC0GvdPK3zC+Ej1NhH3VBoa//UAqmnmcL7y/1IJ2E01iLE5YNjMzN rIENzy+FyBUjJEi3VW2PGG0tKFHPnwyZrzkHL0qM+IA4wz/qOtKoLFTUN17jofbLGwen /lhmn5xJKBuHowKeE3juo1BtiOooXhJ6XDQjscIJJqfr65l5TQ8Cot+S3ZXSkRuF98IP ScB1KTNBnF0mEfjpocSLIcLHVgMKxq10WsUUXt0lkK3WCuMEgkbkTydU/gKvjnZsf3Xi YcJM6kltbHile3gLzppOUA+TAvhVnZHHDyr9EgAtea7axQQVdO6N1AX4GzC1Dpg8PYt0 rJFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H+23RmiB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v2-20020a63f202000000b0034b6bbdb45esi9609571pgh.47.2022.02.28.12.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 12:14:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H+23RmiB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A579C166E08; Mon, 28 Feb 2022 11:36:51 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239697AbiB1SE3 (ORCPT + 99 others); Mon, 28 Feb 2022 13:04:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239187AbiB1Rwj (ORCPT ); Mon, 28 Feb 2022 12:52:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC21493194; Mon, 28 Feb 2022 09:39:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5AAE56156B; Mon, 28 Feb 2022 17:39:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E050C340F0; Mon, 28 Feb 2022 17:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069986; bh=0Dr3gRhH+CgEtiZ4s/Z9cMlnUNTk/O/bL+ukYHRkZDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H+23RmiBYdt4UYhJTRscaeGIUiwykOW7CGjnB3N/FHJwaoUdso2A6B51V8v7c0bjF bLOu+0OLtnmyrJJDVCuVPfv4wymN1qKE3hSTiAcEx7t6RCgqTwNZvgaDS6AICZhQ64 qtbI/8xTbiejoKrGPnvYgaAAnMGYHTqLM+dhofgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Tony Nguyen , Gurucharan G Subject: [PATCH 5.15 047/139] ice: check the return of ice_ptp_gettimex64 Date: Mon, 28 Feb 2022 18:23:41 +0100 Message-Id: <20220228172352.632165828@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172347.614588246@linuxfoundation.org> References: <20220228172347.614588246@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix commit ed22d9c8d128293fc7b0b086c7d3654bcb99a8dd upstream. Clang static analysis reports this issue time64.h:69:50: warning: The left operand of '+' is a garbage value set_normalized_timespec64(&ts_delta, lhs.tv_sec + rhs.tv_sec, ~~~~~~~~~~ ^ In ice_ptp_adjtime_nonatomic(), the timespec64 variable 'now' is set by ice_ptp_gettimex64(). This function can fail with -EBUSY, so 'now' can have a gargbage value. So check the return. Fixes: 06c16d89d2cb ("ice: register 1588 PTP clock device object for E810 devices") Signed-off-by: Tom Rix Tested-by: Gurucharan G (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/ice/ice_ptp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -846,9 +846,12 @@ exit: static int ice_ptp_adjtime_nonatomic(struct ptp_clock_info *info, s64 delta) { struct timespec64 now, then; + int ret; then = ns_to_timespec64(delta); - ice_ptp_gettimex64(info, &now, NULL); + ret = ice_ptp_gettimex64(info, &now, NULL); + if (ret) + return ret; now = timespec64_add(now, then); return ice_ptp_settime64(info, (const struct timespec64 *)&now);