Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp937384rdg; Fri, 11 Aug 2023 05:04:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyZkNFK8p9P7wKee7NLURDnAilWtlcxTt/H/IonQY/BdUQTp2cxnkH1A3wwlzXWsrk6mJe X-Received: by 2002:a05:6a00:3915:b0:686:2526:ee70 with SMTP id fh21-20020a056a00391500b006862526ee70mr1891792pfb.14.1691755440751; Fri, 11 Aug 2023 05:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691755440; cv=none; d=google.com; s=arc-20160816; b=mmL90UTwBfgQYMwq54trp+LX49BhsrXYjqqUryfOVq05LhhzjhrKAKC+i+iUAA93B/ QwalOYdd4Y494Dc265qnpuYkSNF7I/rHTAKQOSG/5QDqLlPlxlZJrI78Eo1PZNtUUqED Gr684neWi0sYEr4fQJV55pnnl+q4ajeSDRnOJz6S1691y1qfHCv40a/UG6bsZSSZjbJS YoMyxd6yuvSBoUJF2C2WhJRZcPOza4yZEPdT7M3dHGaEVFqCu91TKEPyw0KZpeVmtte1 YUzDX/V/ddK7Buz+BEhOBAHAcQg6yAISdezm8yHCO2RI/dvayFPotH5Sl7cT24qrY0uA v06A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=/VTZZRVgNpeD3J5yb4esLjgOsZGEP8aPRLE/rrgsIMM=; fh=gguxAtGgKTtkAi4A+7fcGfHShxeSmYTNov9xsmPfI1s=; b=TQtzHlctvX+N1v2Bt8VfL2OA9q1/u60CLGcRF6ixb3umdI6UqtJa9gDb8UCEdQMWzI vBvbkl28I182ckTzjAdbf87KWeSejk5NsiuYLLKVThcoJI5gHEl6OT3edR9bz0yPEhtb Hmp6wLWPUDmu8uRopuPzYD1zmdy4xo0bHw8VoMQZyudUEVEXi09cQAO4kfJB/IQdU6+n +5WEqmrtvW1TR6SEiyWFBz9k4nFt8wucLfHkKnqrNkzK3Pa/O7BNQoIO+venS5Ivio3u a76vTfxsPM1Ra1waYSl0Vv8O8mbcQSq7zAysukOKTgZngBF+sj/+7ORXnpb0xgNsMSr6 2Eaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dBFTkGpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv15-20020a056a00414f00b0068208d19b1dsi3227167pfb.153.2023.08.11.05.03.47; Fri, 11 Aug 2023 05:04:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dBFTkGpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234519AbjHKItU (ORCPT + 99 others); Fri, 11 Aug 2023 04:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbjHKItS (ORCPT ); Fri, 11 Aug 2023 04:49:18 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA822D79; Fri, 11 Aug 2023 01:49:18 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37B612KG026901; Fri, 11 Aug 2023 08:49:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=/VTZZRVgNpeD3J5yb4esLjgOsZGEP8aPRLE/rrgsIMM=; b=dBFTkGpNEQcZF+HtUBCwv8wFhPxCMy4HMknIHzi7qAAsd1Gq2K60jrtFdWk9AWPh+To4 JYCVoAByZwUWZF7BUWYokp/+UWjfKAs3o1sLOf4SD8TKRGeqHq+rZyeP2D+pjMxVZUI1 CbhxdSYZPjD24fx7d3ezT+3puCh9CADA4pjVQkI5FHUoWqpqS6OplWB3TrzXXqVCozv3 UsJlKq4dqhqDxSfu60jPCV5GiKnq+bOUnUJVyJklE0W0I+Tev8cCYl2IYqbRU4tcDXIf LLy96wIyhlA9NO3NjzXz0p+FXVOODkZh5VZemxuEmxwwY7s1PTVeTT8r4+v6a4SW7vzg ZQ== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3sd904s4qc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Aug 2023 08:49:13 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 37B8nB6P026425 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Aug 2023 08:49:11 GMT Received: from [10.50.43.50] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Fri, 11 Aug 2023 01:49:08 -0700 Message-ID: Date: Fri, 11 Aug 2023 14:19:05 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 4/4] venus: hfi_parser: Add check to keep the number of codecs within range Content-Language: en-US To: Bryan O'Donoghue , , , , , , , CC: , , , References: <1691634304-2158-1-git-send-email-quic_vgarodia@quicinc.com> <1691634304-2158-5-git-send-email-quic_vgarodia@quicinc.com> <2214c31b-eca2-012e-a100-21252a724e7c@quicinc.com> <8b72ce47-c338-2061-f11a-c0a608686d8c@linaro.org> From: Vikash Garodia In-Reply-To: <8b72ce47-c338-2061-f11a-c0a608686d8c@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: climRvHzOqzgnnOlnRu24vl88KyaF6oI X-Proofpoint-ORIG-GUID: climRvHzOqzgnnOlnRu24vl88KyaF6oI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_20,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 priorityscore=1501 adultscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=524 impostorscore=0 mlxscore=0 clxscore=1015 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308110079 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 8/11/2023 2:12 PM, Bryan O'Donoghue wrote: > On 11/08/2023 07:04, Vikash Garodia wrote: >> >> On 8/10/2023 5:03 PM, Bryan O'Donoghue wrote: >>> On 10/08/2023 03:25, Vikash Garodia wrote: >>>> +    if (hweight_long(core->dec_codecs) + hweight_long(core->enc_codecs) > >>>> MAX_CODEC_NUM) >>>> +        return; >>>> + >>> >>> Shouldn't this be >= ? >> Not needed. Lets take a hypothetical case when core->dec_codecs has initial 16 >> (0-15) bits set and core->enc_codecs has next 16 bits (16-31) set. The bit count >> would be 32. The codec loop after this check would run on caps array index 0-31. >> I do not see a possibility for OOB access in this case. >> >>> >>> struct hfi_plat_caps caps[MAX_CODEC_NUM]; >>> >>> --- >>> bod >>> > > Are you not doing a general defensive coding pass in this series ie > > "[PATCH v2 2/4] venus: hfi: fix the check to handle session buffer requirement" In "PATCH v2 2/4", there is a possibility if the check does not consider "=". Here in this patch, I do not see a possibility. > > --- > bod