From patchwork Fri Jul 2 18:29:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadym Kochan X-Patchwork-Id: 12356395 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A971C07E96 for ; Fri, 2 Jul 2021 18:29:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4EFCC6140E for ; Fri, 2 Jul 2021 18:29:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230207AbhGBScW (ORCPT ); Fri, 2 Jul 2021 14:32:22 -0400 Received: from mail-vi1eur05on2124.outbound.protection.outlook.com ([40.107.21.124]:46816 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230115AbhGBScU (ORCPT ); Fri, 2 Jul 2021 14:32:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hZjN/j4uNQfr+AmB2yIHKcOo9aS8emmRwIFRZnZvmPWwguDEb8lS8w09ss9N4k0Ib1d1+cEhUnGdFjmRmTKPJ/Egd1Viucw4KNBrpJXpXCbc5K0gv8YzQby1GeXFim6JkP+D8wBMOo6FZtv5tHtb2yXsNV9upZbiIkhIugFoV/dgFDPBFXtjH6cy48guV3MqNaoFbAwPbPySH0Vk2mSBqxfykKty7KxQa8rOo5yJnOI5hcIxx/oFQ0dB468lG5MHd8fdsK2fy71UK3S1UbNDWtsBx2AyjImj8iPuKeyd/+iVO/TyzuiOlwC4lHbgXJH/FxgzkyaYMW02tzUygaaMYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LxSjiu8IfMhD2mbGIqePBMiVmiMtjHrQJ4FJ1AwMn1k=; b=kqPzlpAOTdicMTzRqKeWhL7ROy0/vIG20rO0ylBzRTo9y609nFsqofoVYJHVhJExmo+gvONRUa3golP5vZ8nKGUbMBd1DJ7ospi7IqBbOTg5hwhFQ5KQjmnH9z9u7A+OOuRzMGsAL133Vb4hCO59bu380WlQX0zxccZfAUkZFUCS5iiGQ2Tn50xk+S1PT3+DILl8c01IOZ3HtKQqAdsPdYqA43r3R2pMkPOqubL/TCD+y1/8F38pjUZXfSXA7RootO70L/CsjXzBBr+DYtjNtAGzgQ0dYT/Lrm2kuoUqxeFxfFti8wHt9hixMsLMVEhM5xYtGZyg1zqiPwKYXtmVBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=plvision.eu; dmarc=pass action=none header.from=plvision.eu; dkim=pass header.d=plvision.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LxSjiu8IfMhD2mbGIqePBMiVmiMtjHrQJ4FJ1AwMn1k=; b=OEiY3kSr5bR1ZsbB310h+hAFxys3qCmzAsLCivMV1UnlBiRs5ye9Y8CMV3bnvfs5OGo9Kh6TjbEVspts3V9DdsLTiRvmCHZtPHjyLEGvcd4mHlED+/afZZW/pn+mRHoGjYTj9dYKBUfELu6ivf/o4yiYbe4ngxuhQMxQsXKIqGU= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=plvision.eu; Received: from HE1P190MB0539.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:56::28) by HE1P190MB0394.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:62::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 2 Jul 2021 18:29:45 +0000 Received: from HE1P190MB0539.EURP190.PROD.OUTLOOK.COM ([fe80::40d:b065:3aa7:ac38]) by HE1P190MB0539.EURP190.PROD.OUTLOOK.COM ([fe80::40d:b065:3aa7:ac38%5]) with mapi id 15.20.4264.032; Fri, 2 Jul 2021 18:29:45 +0000 From: Vadym Kochan To: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, Andrew Lunn , Jiri Pirko , Vladimir Oltean , Volodymyr Mytnyk , Serhiy Boiko Cc: Vadym Kochan , Taras Chornyi , linux-kernel@vger.kernel.org, Mickey Rachamim , Vadym Kochan Subject: [RFC net-next 1/4] net: marvell: prestera: do not fail if FW reply is bigger Date: Fri, 2 Jul 2021 21:29:12 +0300 Message-Id: <20210702182915.1035-2-vadym.kochan@plvision.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210702182915.1035-1-vadym.kochan@plvision.eu> References: <20210702182915.1035-1-vadym.kochan@plvision.eu> X-Originating-IP: [217.20.186.93] X-ClientProxiedBy: AS8PR04CA0108.eurprd04.prod.outlook.com (2603:10a6:20b:31e::23) To HE1P190MB0539.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:56::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc60716vkochan.x.ow.s (217.20.186.93) by AS8PR04CA0108.eurprd04.prod.outlook.com (2603:10a6:20b:31e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Fri, 2 Jul 2021 18:29:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0604c0b2-2392-404b-3213-08d93d875d9d X-MS-TrafficTypeDiagnostic: HE1P190MB0394: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n+neQMYGYgMAa2GB6XLErqqfckKvo/OrKq8/CRgshex5r9iPcwoYmQpDtGJltDEK0x2O7TQOpiRRl0aTnMJEjpnvwqi7NlPjRN8iKQR2TAcG7ULzIzXuV88sw1fosqs9dFBHABQbJxjr76z9fB5CqD2r1JCmJ0+bYs1/gjAbzERlM7f3qjJS7AcdOJIP5oXyUr1bPbvS+xbz86qcC3DOoL2qsbY5Kq6r73KFvw2UelUp1v0ru/1ZSlBHbqDz9j0knRRu3QOP5Xr/RZnLfob2q1AWJ3wDv9IdHRF3uVXoJRKgIqYl0gVeeJoi7YwC8ZhsZW98yAoqw9bxN10fTX3VbzzR9qtCCby/KPmV+YaQYegnUytx1dymPU694CaAnnqSUgHnubWIIic0/TJICrBwSa5XSqxZ7RayhKxTGI3X1sOtO/dQWGzyefzsGZiw4i61NBPneLEY/his9t9OeyFWcIy9BjmztDBP0RlqaFOjf1AiGOp1PCZ0V2kvx5vlHqtOP/ZsmvAwrLpE+OusL1uDFU5bCdeKf24TwcrDmO8kzsLhKRBemwdb36VUdKmz7HmsxfYfoJ7IpGf1SjyoC6WTnHvJ0OrtcB1Fn0u9YJ/LZcAne11zN4Jq4kr5FjIQfMueFPV+lFdwr6vnCjKg1sXxwQih3Mgi7Nd1JtgEIbXzDDb6urF8ooVQOZ9YXhXQddblOJMg3Ejb/vVNT05e3C8N3gF9/i7Ngb5KgGqTjG/jYwc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1P190MB0539.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39830400003)(396003)(366004)(346002)(376002)(136003)(6636002)(7416002)(2906002)(316002)(110136005)(54906003)(44832011)(2616005)(956004)(38350700002)(83380400001)(86362001)(6666004)(36756003)(38100700002)(66476007)(4326008)(1076003)(6506007)(8676002)(8936002)(5660300002)(52116002)(16526019)(66556008)(6486002)(26005)(478600001)(66946007)(6512007)(186003)(135533001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: P71OMki/uARe8rkLvCjlY0/KbFWOA24y3uGqu2JtdziELIyqJoJieFdzqV9lNrPj1LSCEm8JqHfyBHe0znppm2Yl4DebSY3adOTvslE1N7F9xa5hoIf/u8Gd+mgbctrWwCMCWCHekKwE6mm9FF4IRB/ngfoyQ3SoSeAgZTxjhB02sccS6edeorRRkGBM4LzAv/07FVb5kt7RFGTzzWGcfu90vFAsNlRjkRolMTA7r0Z2hQ0NuQghbIWy9663nenYn6ZF4Mgy2Tb7n8vzfjlyFz1vDc0pI4+VaelBZ+jGppKmSVc2TfIvgYIv7BP20vvohGZBjJELTi69M8JfyaAvh9/L1EqLBr8UUAIaa9fr1APJw/9wTRZxV2R8qnaMjni0vy6I7j7XcZE0hgDAwK1AOqkyImuYPCzT2pQH7gazTuyfX+7my1rCf1sBMCQfG88A5arjz67emeiCAFVZsU8sIMHY4TF5c8ZWp3EkD2+WYKYD9g8J4746sVF/eFWRvFroTqj2E+32PUjFpzTNEVFUvpUEC9q9P94bPSLwuum9Wx70BvQusMCBBSKLe2m/Ldx3493EyYI9Jsbht1aql6N3FR5/F6hbAnjarHj4etunlAP0JSw9mUd2gNeegCoJCuO352Cc9kTiDREnSpG8G2tArRvu9ETWeqlg954oBvcslVwQ6f8Mv67CJRe1iwwni+A5yik3OapghaKfi9U0RvkBaqdnF2B/D8HUDvbt98qiAMy9Mo4YgXXptbne2MvZV6J9u3qELtL6ttwM37kn5l/AXtEQrmc48qx57NkEfgXtaenFPx6zzALgSRVm6SrSbpLarrhcNfa98QTsW1ri+oUX4hbIle19fYeP4AS5spGXfcph4CHzwuDjVD60/z4BaHeJ8ucRz8n13IZcqlvFhqLHE50hc5+q7AQ0gQv57FZucTEzasg52YWI5zYj5lnDMhl/GTYF+sXq579Ou5+tkAa5ciBOy0RXGvsb8ny+INYb+8EeafXICKCAn3KSOVOC+35soJUE7Qyz8FsaMDE2W/37+ol2tRBwszPmBp5MdRpnLTxdsVHBnJZxiDnGjFOGktqE2pjqhvMlPmTfPem6u/3H1unGyAWtFrnmnRRao6d9hke722T5jP996CiokINO6J6sXudbKb6dovrrwcH2/Zv2/W61jMjqR0fRORmwJ5FhD/W8qObqeFjr8yPS75LKZoAbJMiKnxMMQQwiWyK/fJn4M9bi1OpxpYJza2VusQPdwO9pSVIzdDdqwx5yVuTdbcmiGevBggU+bOPUfSFDGCcqsBm46DVt2lN5Alj4+VP59CrymYk53j4FbXuEwwlj73xf X-OriginatorOrg: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: 0604c0b2-2392-404b-3213-08d93d875d9d X-MS-Exchange-CrossTenant-AuthSource: HE1P190MB0539.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2021 18:29:45.1877 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p9N7QkkwsEcP/4imLYh2r1GXgd90fObsPQSiTlYjDWT/unVXKRay9L8ScXNolCEuYb70y9GWo0qtQkiOmWo1RDcyey+YNrDOW/tfkqLveNE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1P190MB0394 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC From: Vadym Kochan There might be a case when driver talks to the newer FW version which has extended message packets with extra fields, in that case lets just copy minimum what we need/can. Signed-off-by: Vadym Kochan --- drivers/net/ethernet/marvell/prestera/prestera_pci.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers/net/ethernet/marvell/prestera/prestera_pci.c index a250d394da38..58642b540322 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c @@ -359,12 +359,7 @@ static int prestera_fw_cmd_send(struct prestera_fw *fw, } ret_size = prestera_fw_read(fw, PRESTERA_CMD_RCV_LEN_REG); - if (ret_size > out_size) { - dev_err(fw->dev.dev, "ret_size (%u) > out_len(%zu)\n", - ret_size, out_size); - err = -EMSGSIZE; - goto cmd_exit; - } + ret_size = min_t(u32, ret_size, out_size); memcpy_fromio(out_msg, fw->cmd_mbox + in_size, ret_size);