From patchwork Mon Jul 8 15:43:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 168671 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp7327198ilk; Mon, 8 Jul 2019 08:44:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyVOmDGjkAGnLSraVVCDFwriHsLIiPkezR7gjPX6a3zucpw2C2tTRYBzOoYx0beN57j5+b X-Received: by 2002:a63:c0f:: with SMTP id b15mr14911223pgl.33.1562600664751; Mon, 08 Jul 2019 08:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562600664; cv=none; d=google.com; s=arc-20160816; b=073ApGeSa+Nd3F8rEplFwjzQSFxGonTGlsoQROlRHr6yvOvn6KCkPoyScpZWlJiuwD qC1dO1x2gKqKUmyyig/yx7vovhDTrmHAczhTizWQGviLNNP9lA0VRBbnmsE+N5FdBiEJ VYbFD2INT9exKQ2D0HfsBl8F1vBzBNca/R88Va3W+3aQnxWSxz6L7zJDrz45QeCysV4w Owl4AJpJfKo2JIaRDYFFDJI/PsCyyTqn1feca3AU87EXi0VllqwCxa62wdbumfXAtwOH iaZitXuqSurDXFZbmqKeXbIqrZmT70lPat8KMmz+vpuoT/hHe8rfgDsa3uJMx7i55MTX 4apg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=320TQZ5w2lNhAFIX1hOIch8yO3WN60yBrBwenhig/C4=; b=c5qFY6xOlje69JSd3ZUNX+624AX+a94eh+hGVWrxdjPhNzak2Ql4zWq7z0KZx3gXa6 wbS2/V0Q5gv2ZL9chMHW0gHJ4Nm8sxFogA/f4N44TBlhMrTMh9u+Lp3go1/eCOW6bBtN bsohyzkX+Q7nWnhJKHDmc+Jgfg/B+x0aISw0KneR3oGvd9mN2JXamZ7uTs6GrBrHIiyB mMzZLTyOXLl8EfXWf4vuB/mSbWNgtXrNTtUN7CHo4Qc7IO2iC9xHu5zB3VMONo4w9EfL eQhHxc+LgAI+mrnbC8jEXa07R+dHQqmxKOxGrJAbH9bE3AYwriCpZ2gi/oZyOTGsS5dK czVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si17362557plt.167.2019.07.08.08.44.24; Mon, 08 Jul 2019 08:44:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391223AbfGHPoS (ORCPT + 30 others); Mon, 8 Jul 2019 11:44:18 -0400 Received: from foss.arm.com ([217.140.110.172]:52032 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391215AbfGHPoL (ORCPT ); Mon, 8 Jul 2019 11:44:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 96AEB360; Mon, 8 Jul 2019 08:44:10 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 93E563F59C; Mon, 8 Jul 2019 08:44:09 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , linux-kernel@vger.kernel.org, Peng Fan , Jim Quinlan , Bo Zhang , Volodymyr Babchuk Subject: [PATCH 3/6] firmware: arm_scmi: Remove extra check for invalid length message responses Date: Mon, 8 Jul 2019 16:43:55 +0100 Message-Id: <20190708154358.16227-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190708154358.16227-1-sudeep.holla@arm.com> References: <20190708154358.16227-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org scmi_xfer_get_init ensures both transmit and receive buffer lengths are within the maximum limits. If receive buffer length is not supplied by the caller, it's set to the maximum limit value. Receive buffer length is never modified after that. So there's no need for the extra check when receive transmit completion for a command essage. Further, if the response header length is greater than the prescribed receive buffer length, the response buffer is truncated to the latter. Reported-by: Jim Quinlan Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index b5bc4c7a8fab..6ef652940099 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -230,12 +230,6 @@ static void scmi_rx_callback(struct mbox_client *cl, void *m) xfer = &minfo->xfer_block[xfer_id]; scmi_dump_header_dbg(dev, &xfer->hdr); - /* Is the message of valid length? */ - if (xfer->rx.len > info->desc->max_msg_size) { - dev_err(dev, "unable to handle %zu xfer(max %d)\n", - xfer->rx.len, info->desc->max_msg_size); - return; - } scmi_fetch_response(xfer, mem); complete(&xfer->done);