Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2684052iof; Wed, 8 Jun 2022 09:51:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymqRZbQBH3yp1rZ/1J7fg76zosgqNapnNBgC48bzA20WCtwgCy+MbAjeK0AHWhoCUHiDy/ X-Received: by 2002:a65:644b:0:b0:3fd:d5d5:8c7e with SMTP id s11-20020a65644b000000b003fdd5d58c7emr12695533pgv.590.1654707101877; Wed, 08 Jun 2022 09:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654707101; cv=none; d=google.com; s=arc-20160816; b=CIJqLD3F16JkvzNuXnJ/ckNmFYjifwwSH4LdpW8Y8fH4OqoQ6qEcI0qEEFSLOa0YGC Jp9M+l+raLBVSPRfN1yeUUZzdlcCnR8r/8oRbZLhGYisHYPqPKkHJP6OAotGybRzEr8x Hk6Q7xbo+nMvy8pHV8W4mYdcA1LOdjW1zfzU5Hb9IYtE+BILvoikLzms4OWb0BrVsSiQ yxH2QFfZfOh6EpDt8vNXdBiENX2rCspiIqFPI3Sa3NX6821GuSIFeDubpBK8xaUiYauq VSZlFC9146+JzUX/YCXOaSQ0D3WAM8RSnl+e+lPqjWMW5Iij9+u2nLRMNOndL0QVdZ7r IVDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wHmSX/+IrCFNegvbLq/KbryGfOKoReahgwi84iPHREk=; b=umjyDHMD6yxFI7sZ3IY+jUn/AnXqxFv0462E1o/WJckZU8ywklj5Qe83aNGjKpj+hQ bOMa3DFn1MgUW0pJn/KzcG0pETUII3ppshTZlq2mSReb19twF8E+WspxrnGr3yObjGEA qxQu0Ps7ktvE20puhJSy7vsscdfxsT39uiPzcdgW1vESgAFhLANDqtluyWkkm5XbQQum JXvX09y3mnQqLNWZBLvAm/f457pKfX9okfsK4DXK+0I/O9QdM0cgvSIxdYVZb5tNYvOZ YwwTtl535IW/hWx/zPYNn5q+nPzhMjinIXBlF/zzmnOm8TnCzQwSaBrJDiOoSAwzhS8D b8uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=exlHTD26; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d7-20020a631d47000000b003fdac2b3990si13497101pgm.734.2022.06.08.09.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:51:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=exlHTD26; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D5A51A5EA2; Wed, 8 Jun 2022 09:24:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245384AbiFHQY3 (ORCPT + 99 others); Wed, 8 Jun 2022 12:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245214AbiFHQY2 (ORCPT ); Wed, 8 Jun 2022 12:24:28 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 159F119C77C for ; Wed, 8 Jun 2022 09:24:27 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id fd25so27832088edb.3 for ; Wed, 08 Jun 2022 09:24:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wHmSX/+IrCFNegvbLq/KbryGfOKoReahgwi84iPHREk=; b=exlHTD26n1woC75nYXQqD7MSrK1NcMRDeViWnpyM21efKY/9x7ptHc9hL4qoeQkdO1 AQ8iLeSnsN5DvPhCnEhnkKAjFAOJHr/RCVkFEg1iCMNfrkBpvF20h055Yxj6QClLkVKG hpbqLAme+/1wb5X8rfHnsDgmRxwlANFef3fm3DCdWWWkKVlefcPO7FZtS3aXcHm9gprA ZJQLQRbsdYtSZEmfoHTlp2RpM+ix4sDpARwADpRARi+pObRWQieQLtxoqxHKVZop0L3S tywQ9+TQ63IrwcbSo3LGJ7eg5FKn2gi7SEZg8yht3/dpG9r04tu8jO7M8/sNEGBCEiic 8lnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wHmSX/+IrCFNegvbLq/KbryGfOKoReahgwi84iPHREk=; b=zoh57KqWZj7bmvO3OzXQ8TiEyiLEN0fIf33eEthqsEi4/IybERz1kA1mahrUaTw6hK 0+4d0O5Dij2Eo3uzBDtf1/BG0052zA+b2e8essC8wQVkRNTODvCL8eLdQVOzyeL8v9UI yjKNRRSs9Dhqzrte+uC1PupfAxBIgKWNZG+JK8VhnDGOqEjk2aYlQys0ScKF++uRABUO NZbP03Za5DxaYsYf9mbwYYXSc+a7pYFwgWkHltpjSFNU/u3q+efBXQ7VVfTULVBT5/qv guYbxOVDzuBS0TKY/1TdFUt/JEFYyb4wZzygtIwNN2QqYz6sbGo+j4ZWoQJcp4DcqJqh zfhw== X-Gm-Message-State: AOAM533V+MIL2L9Pawnod07nxlW4lmECxx773eV8xfXn5bYSnlyewrX0 vmvHhLgB/ifqmxeSb4Rd+trYJg+fj8lVklZhXw9eJg== X-Received: by 2002:a05:6402:350e:b0:42f:b2c1:9393 with SMTP id b14-20020a056402350e00b0042fb2c19393mr29818135edd.11.1654705465508; Wed, 08 Jun 2022 09:24:25 -0700 (PDT) MIME-Version: 1.0 References: <20220608110734.2928245-1-tzungbi@kernel.org> <20220608110734.2928245-21-tzungbi@kernel.org> In-Reply-To: <20220608110734.2928245-21-tzungbi@kernel.org> From: Guenter Roeck Date: Wed, 8 Jun 2022 09:24:14 -0700 Message-ID: Subject: Re: [PATCH v3 20/23] platform/chrome: cros_ec_proto: handle empty payload in getting cmd mask To: Tzung-Bi Shih Cc: Benson Leung , Guenter Roeck , "open list:CHROME HARDWARE PLATFORM SUPPORT" , linux-kernel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 On Wed, Jun 8, 2022 at 4:08 AM Tzung-Bi Shih wrote: > > cros_ec_get_host_command_version_mask() expects to receive > sizeof(struct ec_response_get_cmd_versions) from send_command(). The > payload is valid only if the return value is positive. > > Return -EPROTO if send_command() returns 0 in > cros_ec_get_host_command_version_mask(). > > Signed-off-by: Tzung-Bi Shih That answers my previous question. Reviewed-by: Guenter Roeck > --- > No v2. New and separated from the original series. > > drivers/platform/chrome/cros_ec_proto.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c > index 6a5771361383..9e95f9e4b2f8 100644 > --- a/drivers/platform/chrome/cros_ec_proto.c > +++ b/drivers/platform/chrome/cros_ec_proto.c > @@ -458,6 +458,11 @@ static int cros_ec_get_host_command_version_mask(struct cros_ec_device *ec_dev, > goto exit; > } > > + if (ret == 0) { > + ret = -EPROTO; > + goto exit; > + } > + > rver = (struct ec_response_get_cmd_versions *)msg->data; > *mask = rver->version_mask; > ret = 0; > -- > 2.36.1.255.ge46751e96f-goog >