From patchwork Thu Jan 5 10:53:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 39482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp242656wrt; Thu, 5 Jan 2023 03:05:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXu7IU8XclgO1LhWjflsH7tWGF9IYjyt3Vf1+6yFcz5BjKbIVOKCfbYoQ9miXz3WPWStys+q X-Received: by 2002:a17:906:3e41:b0:84d:855:dd02 with SMTP id t1-20020a1709063e4100b0084d0855dd02mr1559936eji.46.1672916733974; Thu, 05 Jan 2023 03:05:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672916733; cv=none; d=google.com; s=arc-20160816; b=VF/Tn+l4yaX4io+wjvwGpfBls64vog3to19yqygBq4lQjVzaZlyMc00MgSuiHLJLsr tS+cY4ayXAzelcNiZpzN/hl4ZC94TZPdRlWmcuDogcW5rmr6qTFDkN13Lfk5rWmnHEqZ qAFtsLzPWxMYGp2m5E8/7Vp6UoLT4svxsGIwyUiOFYC7syM0GG1/nSoWYKw+RjGUzrTw MKSXkESg4aRdZFvdnucZYXe5bYKvaeolvTVQ2TRsjCiTyUNehIkE0d9TLeblYwTmnDx2 wWxfx6E16pATwM//f+8Du+XEW41H7GEWsRPR2+IfDiqv94DbJdeGWCKAoGYtYtUqvtHI +4QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=TdHeHF4mTbDvrlFZGioHAvpse64q4uNez3wi8r/aN44=; b=s8+Omd3UOyNv5QT2/GXZAf8vZ2ehGiw24R8vDF7Ug7Iz0I1p5zYc1LVjBR1BFqEuiC 3TxmP2gBpOrGfg/5pDjxDUK/Rq+51OnKGuXlmZQYTMp0GRiTWanfeCLjPcWIpkoYPpdp 1FfqQAWqLzW+/+usQj6qAkgzNdxiy3GA/kp+nBMJdpBuuKgIgfL2g3amFUA5KgHV7Jds rUkAJC6fP6tyi+aoozt37F4s1y726aIu5RRtVzEet+9+dHZOz0Qj+1bz3G6jEuBDnLDa Jl1fkxY9+lhMRqDObMX7+o8Kzqxr+hpwf5qxDzvmUYRl4gooDpof2KBo3cWO7Ppt1ZMM b9cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fOxOeudJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk8-20020a1709077f8800b0078d20d71475si33530947ejc.413.2023.01.05.03.05.10; Thu, 05 Jan 2023 03:05:33 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=fOxOeudJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232464AbjAEKyn (ORCPT + 99 others); Thu, 5 Jan 2023 05:54:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232369AbjAEKyX (ORCPT ); Thu, 5 Jan 2023 05:54:23 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C134C724; Thu, 5 Jan 2023 02:54:22 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id s9so3699127wru.13; Thu, 05 Jan 2023 02:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=TdHeHF4mTbDvrlFZGioHAvpse64q4uNez3wi8r/aN44=; b=fOxOeudJ7qAy0oYQORrvEOu/JM0hFJeJ7YQDLVMxcniHQrkD783Ur7EDAe6AYxPcDc oPudqEezkneoTporSI8hTHexd73DDS4IGDNLVgcmSK/fWTNRH6YzPPp2Lqip/Rdlans7 hSLGK/EDE9a1CRKpdFYv38u/op+ZrUej1uw4uyAMtED5fPDt0fMkkh5UxWPqGuv8pcFO cqe0mB3KDGgyfJ72VlWs53M1NmELpcnC2LNzEolrhCnepUZuL60lnidKj22MDQe+k3Fp Gm15xfPAqsSTlqgkMR0kfMEqKoCI2u8tvAuL5Fq8ZKZmE4fsdxqsLCuOHyJWrg2eOWB2 5kmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TdHeHF4mTbDvrlFZGioHAvpse64q4uNez3wi8r/aN44=; b=nU8kdjIHP+6OggleH+BkPPFR1ccn9LHRsO2lCGTEygZSDJEpaQmD9qfLwT7Rc9+X/m ooZrKvEmzmFPYd4Qp94Nvy3U9eXXdgutvWqW3+wXvdfR9+1F/KhBJTnZIq+yr7o/ZPJ4 w9KeeKDTNWjCxvcCRW5dK6f2nzi4s0xK+XtQbike6jXFtx6hzF2F6ThlLXoo3vjpJJKu wpes9mCcEjd2b4zeWyyamnJ6nPi53Mchqft2vhXzxPOaop5Hc4M/YQc8t4JMl78WWFAk iS882WGGfThUIwf0AtWXG1t6Gy7Vy0StOnNRFDTKR6b7CNatc71WQgeHTM7Jmk8dcj7Z qbGg== X-Gm-Message-State: AFqh2kplXhXf8vw1mV9EcYsJ3odOQBA7SHqCGA8/gRVhFP2bzwTaiB3T wkYUAfI26YYzvMkcu5CVsTQ= X-Received: by 2002:a5d:5b17:0:b0:2a3:50c5:9c29 with SMTP id bx23-20020a5d5b17000000b002a350c59c29mr3734303wrb.14.1672916061080; Thu, 05 Jan 2023 02:54:21 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id d14-20020adfa40e000000b0029d9ed7e707sm8256321wra.44.2023.01.05.02.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 02:54:20 -0800 (PST) Date: Thu, 5 Jan 2023 13:53:42 +0300 From: Dan Carpenter To: Souradeep Chowdhury Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Alex Elder , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] soc: qcom: dcc: Signedness bug in config_reset_write() Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754180336910197752?= X-GMAIL-MSGID: =?utf-8?q?1754180336910197752?= The "ret" variable needs to be signed for the error handling to work. Fixes: 4cbe60cf5ad6 ("soc: qcom: dcc: Add driver support for Data Capture and Compare unit(DCC)") Signed-off-by: Dan Carpenter Reviewed-by: Konrad Dybcio Reviewed-by: Alex Elder --- drivers/soc/qcom/dcc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/dcc.c b/drivers/soc/qcom/dcc.c index d4101f79cb5d..1e2cbefc1655 100644 --- a/drivers/soc/qcom/dcc.c +++ b/drivers/soc/qcom/dcc.c @@ -808,8 +808,9 @@ static ssize_t config_reset_write(struct file *filp, const char __user *user_buf, size_t count, loff_t *ppos) { - unsigned int val, ret; + unsigned int val; struct dcc_drvdata *drvdata = filp->private_data; + int ret; ret = kstrtouint_from_user(user_buf, count, 0, &val); if (ret < 0) From patchwork Thu Jan 5 10:54:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 39483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp242726wrt; Thu, 5 Jan 2023 03:05:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXuDPF2Z5z6QZPilaEYS1F+biuNP1PXG15FXYUNb6wwxpp3k3YPTNbecC4whFOILXKzNj6he X-Received: by 2002:a17:907:d38c:b0:83c:1a1e:1efe with SMTP id vh12-20020a170907d38c00b0083c1a1e1efemr42383354ejc.6.1672916741188; Thu, 05 Jan 2023 03:05:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672916741; cv=none; d=google.com; s=arc-20160816; b=x74wOTIOZlej0QSqRGrCmOUDasWIF3Zoykxt6RypH0c6VRv08rnLtEJmWtLARka2TE mmurHJvmpSxQNIqQUcgRo9XV+6AHKsilfCJ7NLWZBdZNAhg/Z9WbnXrff/OIR54uTSC6 3scYC415VR3Lf/yhupaSLTNZShKQ1JbRGlQA/YV3o/vt4W24FzfejjXdG7oANf3KGygQ 3PmxiAq+MdIMY9V3qKyoKkK0eZN5Y7Z8pqg4uhRsazIBUo00WjqwPAyCe+7Ydue0Qogr mL1zG9qg8oku49Ykhg+l77ECLoOOAEHjwHDguzcAgGGICFu5z59Qjq2zdtpOLdNERKWd Wbdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=jv0GR470MWgiD3mfl5X1bKpTXHWvkolc5a9wY9HKdXc=; b=A30lfKDHSItrDH9Xa1XNzqC8hLfl26nJ410XuS7vY2se8XnXYxeH5QJiCnuKr/7hWt SOeJcMbfvDAqpyT4kfTeBfv3ZJ7rtxBXMnVmLLHg4eGxeE8JUxQSYlyAtK6ow/sqgRNJ ETwdL3u4KyNvDYPKaMna8rNmQMpCOepXCuHgQCUf1rJo6LidSnMF39rZLJo864L62T05 tTxPr4dEe3VTQQooP8bQgtm0Fx834Onp5hhzFeyocd0lLgvm+KxGxuArv2pFJ3EgMqTP r0bfW5XSAbFfS7Datai5KNtvpbE71QDmSWIIp+LA5ad4Npqgn94GlYiOl7tEcGSDLfuh vVzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="bIxbw96/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ww3-20020a170907084300b0084cbf5552aesi13509649ejb.964.2023.01.05.03.05.17; Thu, 05 Jan 2023 03:05:41 -0800 (PST) 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=@gmail.com header.s=20210112 header.b="bIxbw96/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232512AbjAEKyq (ORCPT + 99 others); Thu, 5 Jan 2023 05:54:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232432AbjAEKy1 (ORCPT ); Thu, 5 Jan 2023 05:54:27 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29E7244C65; Thu, 5 Jan 2023 02:54:26 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id r2so892290wrv.7; Thu, 05 Jan 2023 02:54:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jv0GR470MWgiD3mfl5X1bKpTXHWvkolc5a9wY9HKdXc=; b=bIxbw96/A1sJN+bIpREHnJIorPMs8VvgHbuaNT/hFwUWdCsSGgO8RUcTOkpWRtjI9G oWHtiPdZYnoOqiyPy2gs6x38EfPE0ZEo+yn2INV9GU8AJbk7fugW0U8Sia7uxg+wN4+H a5eUzKEfEG3dZ1Q32U+0AWjIPEphHI4YaUjhfnNM0upYEUH44QiMGnndQpYXrjqhPwGY qfL7+0DWsb1KcZM2gE2eCYCn6jJuS1AsjwGxNRc0ryBZspPVxA8hKZLVaYC3H0tWgvLc tZnoGMWMiL/Dp4syYkFWEwDuWi5/YSC4i4EyGTOxc9v5+bDiSIr+dadoGN2/5PtgDq27 0YyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jv0GR470MWgiD3mfl5X1bKpTXHWvkolc5a9wY9HKdXc=; b=HpLd+vqsLBnxTMl9MWIkzSgRi+MhdPG84vM3WRO7SnOhbnk+zglVWyv2OkhGvVMlHZ SAWzvyUbxSraxVS9wPUFBQclW+WHrtFfHZBsCminLYSp7rwtleKDmmZGTi/CXzDl9oYC vD5yobowDtiHXqjcM8SGvcN8l9m9pMOQi+gT/KHGf4WsASrvb5ISa019Hdxpa+svpReA t8tmagSp8qf116CMTTuJ1aSDs36ynv3aoVsKC+mCBsCXWKdpsMp006VWW9pgbc/u+ri1 li9wr5bjlhAvbeEMJBXlgwVuxI5cpW2wsKGQ8+CgDhtdlAjeYM4urEcmRJG4P2QPeCsi z2rQ== X-Gm-Message-State: AFqh2kpiviGWiljAHxlNGQeV7fUSuVZyRrj48LC6HTLtl2KnYriIezYp +U3PQR6FsdJRV6chlD+uLBI= X-Received: by 2002:adf:fe09:0:b0:242:149c:6d29 with SMTP id n9-20020adffe09000000b00242149c6d29mr28395857wrr.16.1672916064665; Thu, 05 Jan 2023 02:54:24 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id bt18-20020a056000081200b002368f6b56desm4557610wrb.18.2023.01.05.02.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 02:54:24 -0800 (PST) Date: Thu, 5 Jan 2023 13:54:13 +0300 From: Dan Carpenter To: Souradeep Chowdhury Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] soc: qcom: dcc: Delete some bogus dead code Message-ID: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754180345066946964?= X-GMAIL-MSGID: =?utf-8?q?1754180345066946964?= It feels very wrong to assign "cfg.sram_offset" to be out of bounds. Fortunately, this is just dead code and can be deleted. Signed-off-by: Dan Carpenter --- drivers/soc/qcom/dcc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/soc/qcom/dcc.c b/drivers/soc/qcom/dcc.c index 1e2cbefc1655..681d55018e66 100644 --- a/drivers/soc/qcom/dcc.c +++ b/drivers/soc/qcom/dcc.c @@ -483,10 +483,8 @@ static int dcc_emit_config(struct dcc_drvdata *drvdata, unsigned int curr_list) /* Update ram_cfg and check if the data will overstep */ drvdata->ram_cfg = (cfg.sram_offset + total_len) / 4; - if (cfg.sram_offset + total_len > drvdata->ram_size) { - cfg.sram_offset += total_len; + if (cfg.sram_offset + total_len > drvdata->ram_size) goto overstep; - } drvdata->ram_start = cfg.sram_offset / 4; return 0;