From patchwork Fri Jun 5 16:24:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224752 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 18EBBC433DF for ; Fri, 5 Jun 2020 16:26:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBDB32074B for ; Fri, 5 Jun 2020 16:26:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PDO192MX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726316AbgFEQZ7 (ORCPT ); Fri, 5 Jun 2020 12:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgFEQZ7 (ORCPT ); Fri, 5 Jun 2020 12:25:59 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06634C08C5C2; Fri, 5 Jun 2020 09:25:59 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id s88so2949204pjb.5; Fri, 05 Jun 2020 09:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xiTMuwQ2X7Lvg1AXoObZHg8t385K8uvAl/6Z6GSCNRE=; b=PDO192MXtCEDH4yvw6uZfm77X6P4U22M7lARMan18YXz3iENPg4XxWelg81QrEsJpn kHAc5uecbkfIa/ZC5+sblLfe20Rfi5qKPaQWV9DvtjnAjFUgUA7lYWbj2QbLDeaiQk1I M2VCJgzSuHqbOb6ZJ3usaDMS04+Qi5vCcDWTtW1U/ksln2oZBSMMLnduaI5kOvnFf9z/ Dx/tcXUsEEPppj/9dwA5mhCnWukXJJv4NeYxxz5F3DpBHpayldKcn8202m0uhnKepd1h t2fWOo6Rbnjextv6pqkAslqz+AKHf9BFn5P2ac4EAq3x+feY/qQoc9leEjYyFeYi+SO1 2X6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xiTMuwQ2X7Lvg1AXoObZHg8t385K8uvAl/6Z6GSCNRE=; b=uWgUYJzAMRnd9tRWz+Zilk731umoPhHwzk8Y5IXLtfGmeMPvyz069xdCCQYkxCoHoN 3TXWBCLqdh4C7aLtTnWrN1nee7C977Azi4Py8r459arP7ORnhGF3MrTndRBmOYKXuIVb o+m2EddMmPJ410CoTsBrWvYJNxCLDKrQoywJzfLON9BsV//EdTHWea1rvcPczUNmDHRG 1Pv1LO1J/5UlWQMxI1MxW+Q+6iLwiisTpy3Vf8zTcwTsceu6FJeb6Br3WFMz4xeIlSbS 3H/GJHh6F8OBY/8qo5N48R/BKKITShz1J/z+s7GduxuR0Lo9TuW9VNFmeanuQG/8tLAV y8XQ== X-Gm-Message-State: AOAM533cwmhDuolHO1UMFkkZ6n0syAVdC4L93qr7Q1Y0USO+zD2rqD8Q S7c4Eb5UpVcoCKpo8DMArM+LHE6P X-Google-Smtp-Source: ABdhPJzHxb4CKJjj1XbqGo+0bkVBi1f+HfoixTcES5XCnrpj/TQdExSyuo2+qImM8vYbsgYhRgeGVA== X-Received: by 2002:a17:90a:898a:: with SMTP id v10mr2269707pjn.95.1591374358118; Fri, 05 Jun 2020 09:25:58 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:25:57 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Colin Ian King , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 01/21] media: dvb_frontend: ensure that inital front end status initialized Date: Fri, 5 Jun 2020 09:24:58 -0700 Message-Id: <20200605162518.28099-2-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Colin Ian King commit a9e4998073d49a762a154a6b48a332ec6cb8e6b1 upstream The fe_status variable s is not initialized meaning it can have any random garbage status. This could be problematic if fe->ops.tune is false as s is not updated by the call to fe->ops.tune() and a subsequent check on the change status will using a garbage value. Fix this by adding FE_NONE to the enum fe_status and initializing s to this. Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable") Signed-off-by: Colin Ian King Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 2 +- include/uapi/linux/dvb/frontend.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 2f054db8807b..372057cabea4 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -629,7 +629,7 @@ static int dvb_frontend_thread(void *data) struct dvb_frontend *fe = data; struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dvb_frontend_private *fepriv = fe->frontend_priv; - enum fe_status s; + enum fe_status s = FE_NONE; enum dvbfe_algo algo; bool re_tune = false; bool semheld = false; diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index 00a20cd21ee2..afc3972b0879 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -127,6 +127,7 @@ enum fe_sec_mini_cmd { * to reset DiSEqC, tone and parameters */ enum fe_status { + FE_NONE = 0x00, FE_HAS_SIGNAL = 0x01, FE_HAS_CARRIER = 0x02, FE_HAS_VITERBI = 0x04, From patchwork Fri Jun 5 16:24:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224742 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 586D5C433E0 for ; Fri, 5 Jun 2020 16:29:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 372C7207D3 for ; Fri, 5 Jun 2020 16:29:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sTwJSvUc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726750AbgFEQ0C (ORCPT ); Fri, 5 Jun 2020 12:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726727AbgFEQ0B (ORCPT ); Fri, 5 Jun 2020 12:26:01 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3B2C08C5C2; Fri, 5 Jun 2020 09:26:01 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id o6so5377104pgh.2; Fri, 05 Jun 2020 09:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FrKureXAugTznm0BDZd4QZA9eNgJhwIv0PlSXJOT72U=; b=sTwJSvUcQ20+52QuZlahVZ/PtgEVkSBVPfH530tFTp29oZT9wXxczb8OHoQU8iS0pN PSdp+BHmPkExZqmwEdgmyOpz7JgFI1CbCT8HQKSrG21QIMe4qYettibVCVjlmh2vmlVp 570ZeirjE28Zo41IQk0XELbF4SeVkGf7gTmTNOt+UrMdLt47PFw32aPo1/JrMx5+/3c7 AhBLnwoCz6GGp7gt/mFR6XL65PLfWOr002c9xWkqRxPDRTJuGfwd3JyWpLxyfq+bctPi m4RsGMZ+NWtHITvNy17FEgOcyzoCYScKnh3z9nfM/7SrC9EMgvdCyj9awU1zVCVhR2iy j55g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FrKureXAugTznm0BDZd4QZA9eNgJhwIv0PlSXJOT72U=; b=ovRBnLB/R924eIijJRGESn9b+giNlAkHdkyFwqFYbrdt6OGZKK/k1P7lxt6JK8I2Dw t8wOVjy63fOYTcOoHUFAQXw1lVEYE42ftQXbLLW7MWHSFwOCchj+f7UxogpVqSiQ04tD WBwKLbW+nhiOXF4xwkm8iNlw+UNMLSdvZFGsVNPZnoiCm7ywstSQRN6NkK9v8sVd9YeA 3frUVfbdAiHzbIIwpd1xtzG4J67OcW20gKDH/x0RF8UfT1eklW4EKXFMiDtDYsN5Uqy/ P5KNc4F6tYbhQCj/g6tzo6Cje1VW/6NNRb4T5mUApBZONpRVjTxNtih0LIEpL+Yznp+E rU3g== X-Gm-Message-State: AOAM530Q2O40p0bkIN9idn5WdFwzLFTnHuuWRYIPu0Mc59IdwUf80BLu 0PLpXZNtA9ey1FHU25XT+XePepSE X-Google-Smtp-Source: ABdhPJzr7d6bll/CqwR+jW9s0alK40zPfr3i3/ktdsLPzXYazAPQVp5BJfS0dLJEvvs1FhpQRG/BoQ== X-Received: by 2002:aa7:95bd:: with SMTP id a29mr10340370pfk.57.1591374360329; Fri, 05 Jun 2020 09:26:00 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:25:59 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Colin Ian King , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 02/21] media: dvb_frontend: initialize variable s with FE_NONE instead of 0 Date: Fri, 5 Jun 2020 09:24:59 -0700 Message-Id: <20200605162518.28099-3-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Colin Ian King commit 450694c3b9f47b826a002089c463b9454b4bbe42 upstream GIT_AUTHOR_NAME=Colin King GIT_AUTHOR_EMAIL=colin.king@canonical.com In a previous commit, we added FE_NONE as an unknown fe_status. Initialize variable s to FE_NONE instead of the more opaque value 0. Signed-off-by: Colin Ian King Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 372057cabea4..3b045298546c 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -458,7 +458,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra static void dvb_frontend_swzigzag(struct dvb_frontend *fe) { - enum fe_status s = 0; + enum fe_status s = FE_NONE; int retval = 0; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; From patchwork Fri Jun 5 16:25:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224743 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 41003C433E3 for ; Fri, 5 Jun 2020 16:29:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14001207D3 for ; Fri, 5 Jun 2020 16:29:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o1Y+Lg9G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbgFEQ0H (ORCPT ); Fri, 5 Jun 2020 12:26:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbgFEQ0E (ORCPT ); Fri, 5 Jun 2020 12:26:04 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 608A7C08C5C2; Fri, 5 Jun 2020 09:26:03 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id m7so3833905plt.5; Fri, 05 Jun 2020 09:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BK5uIPuoj5s3p1umbZFHQonWFQu9J5ojGIynUIx7wUM=; b=o1Y+Lg9GRJIjG8s92hys4u8VNy2FlWfVhj8RIt0DPU3v3vU+fXtiAJ5b10Eclt8AdI ekQWzGhmugOXdsdgn6RUO4hVXR3RxzroXWol58QZdgDTuutR2RRGPdY3h7D5qnDvJgbm DSqjMPkeYbW/1A6BXjpxtGrDTKn47GRT5uXE+8XKsRaYZb06Hv2fq5WyWoWknqSXr3AC UTPKncETIZuSVAeYvtIKDKLj+NuL/52UNUdXkGg1JvFBk0TC6igA665USAll5lxKiFPl pWyu/9FPvuMwWjzX3JkTt/raS/PiH/BbQ00tTnOZspvRrvac4YI94xg0AuOrI2KAbSyw e8yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BK5uIPuoj5s3p1umbZFHQonWFQu9J5ojGIynUIx7wUM=; b=WnK5KWw9boUK69X4nkslw2Va1zVjyyEjCajVXcQCVXP6sRyBw+ux+dsxeXA5Sb8Mb2 dUh16KjVV/G4qEr2U9g/UFpjN1LGujt/ixlmoGvGpz2ME7LP5eULZ4gpEVHsoih/lKwG ln1FqzrnEe83nxjYVDgiX3yUFDW2MV+BOEeeg6+Gnypc6Dd56BBaI6kHZ94jEzEGzXLk bdnVJkp3SHtrPeffQvUDxWyEixc9w98rgT3nqZUAmQPc9VbkCkvX9qSSiHQ//hs26+M7 6bdTBK4xnmDdFnb5FDHWg5DWHRl6hlK81C/lr8NozCEHD8wm7U5BJuy44DmtdwePfvJl rahA== X-Gm-Message-State: AOAM533pBwSdPDZI7KpvXEBJ2c1ZCGIzyjsYRKqSF82VwFr7Z7k2vGSx LLl32BWJSdwuMREiob8uC8ADsk4p X-Google-Smtp-Source: ABdhPJxoA8r8XBGDgg/yFx4eRcKgWc49CV2edBLecXIp/5z5xiHV048E+xGGFOBu5mDQDVHIPKoxQg== X-Received: by 2002:a17:902:a505:: with SMTP id s5mr10619204plq.20.1591374362435; Fri, 05 Jun 2020 09:26:02 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:01 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 03/21] media: dvb/frontend.h: move out a private internal structure Date: Fri, 5 Jun 2020 09:25:00 -0700 Message-Id: <20200605162518.28099-4-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mauro Carvalho Chehab commit f35afa4f60c868d7c7811ba747133acbf39410ac upstream struct dtv_cmds_h is just an ancillary struct used by the dvb_frontend.c to internally store frontend commands. It doesn't belong to the userspace header, nor it is used anywhere, except inside the DVB core. So, remove it from the header. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 11 +++++++++++ include/uapi/linux/dvb/frontend.h | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 3b045298546c..7eeb5d302c9c 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -998,6 +998,17 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) .buffer = b \ } +struct dtv_cmds_h { + char *name; /* A display name for debugging purposes */ + + __u32 cmd; /* A unique ID */ + + /* Flags */ + __u32 set:1; /* Either a set or get property */ + __u32 buffer:1; /* Does this property use the buffer? */ + __u32 reserved:30; /* Align */ +}; + static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_TUNE, 1, 0), _DTV_CMD(DTV_CLEAR, 1, 0), diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index afc3972b0879..3a80f3d1da1c 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -384,17 +384,6 @@ enum atscmh_rs_code_mode { #define NO_STREAM_ID_FILTER (~0U) #define LNA_AUTO (~0U) -struct dtv_cmds_h { - char *name; /* A display name for debugging purposes */ - - __u32 cmd; /* A unique ID */ - - /* Flags */ - __u32 set:1; /* Either a set or get property */ - __u32 buffer:1; /* Does this property use the buffer? */ - __u32 reserved:30; /* Align */ -}; - /** * Scale types for the quality parameters. * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That From patchwork Fri Jun 5 16:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224744 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 E9D13C433E2 for ; Fri, 5 Jun 2020 16:29:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C22B72074B for ; Fri, 5 Jun 2020 16:29:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lRsBh9rY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728043AbgFEQ3A (ORCPT ); Fri, 5 Jun 2020 12:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727037AbgFEQ0M (ORCPT ); Fri, 5 Jun 2020 12:26:12 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B23EC08C5C3; Fri, 5 Jun 2020 09:26:12 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id 64so5120575pfg.8; Fri, 05 Jun 2020 09:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dASDXMiZEph5YCTisMlHTdhBBOP44OwUKjYtbrazK0w=; b=lRsBh9rYlD3/klFZqakJ0sVqCrjSPf2sDijjIOPnDVwZ7apuHjMIwwQDkp0+o754gF 4/xGNuMr+V1FHGugjT8Ie3mOvRMgbkxkDzn1B1wmUksTu/6TkerWdC4b5JgLu6MmHpVq qGU0/l0rodSFQVrMSXc6gP4B7Pqb9bcYNABfaqO0EyBbBVsnEskMDEt8tJxFCGtU/EQe i36ujV6luk8DndCyrMCvPNxMMfB34OiDPeljv9TEbLLh1INxeEBEOOVMaFI1bmu1XC+J oOshsyJtmIG+waJl7NW2fTf6KGn3GipfU5B45FbpYN7hvkgZ8TLEm6+UYw1cS+qD75L8 9+iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dASDXMiZEph5YCTisMlHTdhBBOP44OwUKjYtbrazK0w=; b=jYpXyNsYad1wDZFYYagu/wWmccRmASORfeJwti5T59pcWhouLMfzbubtL+DcU0ssxn QQK2lQv9Xi02wRLGPAA8yB9IJ3mL4gMvO/X66MvM8A1G2WWsjq7320WeeVkrfA6nHDOG jfnog2fb+dtSP4I+kN/HUy+Xte5+ZHlu/hKZnQOvX0c4YYO57H+HE9wLkD02MILcDtRh rfXXHTFAIXH2RPr5G9Dh5Zs6RnWfuhfCtIseJO13v65ZqYAEVA5/imdlRqrP9kFK7naa y1MLPxZQTPYpjyUx/ZUeOPCRc/JvzTTITTjcQo8QPHEvzbX4V7eb33/szFJBXfpTGpme L8qQ== X-Gm-Message-State: AOAM531AuyWN6mhHlqDRaVgXuzWen0wNtzDbgQEeAb/ioi0o5QQ5tJWV /nlxBOSvnKhkQILSWsWSu3EmWjga X-Google-Smtp-Source: ABdhPJwXx/cGe9xW2SYlzP6+8kzFsQ21N0G0adYtcyJqEYt6Q8PYpLKRa6OKd3iLBwEm+8laxXxzXg== X-Received: by 2002:a63:7519:: with SMTP id q25mr9985787pgc.224.1591374371249; Fri, 05 Jun 2020 09:26:11 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:10 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 07/21] media: stv6110: get rid of a srate dead code Date: Fri, 5 Jun 2020 09:25:04 -0700 Message-Id: <20200605162518.28099-8-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mauro Carvalho Chehab commit 282996925b4d78f9795d176f7fb409281c98d56d upstream The stv6110 has a weird code that checks if get_property and set_property ioctls are defined. If they're, it initializes a "srate" var from properties cache. Otherwise, it sets to 15MBaud, with won't make any sense. Thankfully, it seems that someone else discovered the issue in the past, as "srate" is currently not used anywhere! So, get rid of that really weird dead code logic. Reported-by: Honza Petrous Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-frontends/stv6110.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c index 66a5a7f2295c..93262b13c644 100644 --- a/drivers/media/dvb-frontends/stv6110.c +++ b/drivers/media/dvb-frontends/stv6110.c @@ -263,11 +263,9 @@ static int stv6110_get_frequency(struct dvb_frontend *fe, u32 *frequency) static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency) { struct stv6110_priv *priv = fe->tuner_priv; - struct dtv_frontend_properties *c = &fe->dtv_property_cache; u8 ret = 0x04; u32 divider, ref, p, presc, i, result_freq, vco_freq; s32 p_calc, p_calc_opt = 1000, r_div, r_div_opt = 0, p_val; - s32 srate; dprintk("%s, freq=%d kHz, mclk=%d Hz\n", __func__, frequency, priv->mclk); @@ -278,13 +276,6 @@ static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency) ((((priv->mclk / 1000000) - 16) & 0x1f) << 3); /* BB_GAIN = db/2 */ - if (fe->ops.set_property && fe->ops.get_property) { - srate = c->symbol_rate; - dprintk("%s: Get Frontend parameters: srate=%d\n", - __func__, srate); - } else - srate = 15000000; - priv->regs[RSTV6110_CTRL2] &= ~0x0f; priv->regs[RSTV6110_CTRL2] |= (priv->gain & 0x0f); From patchwork Fri Jun 5 16:25:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224746 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 22581C433E2 for ; Fri, 5 Jun 2020 16:28:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F33E62074B for ; Fri, 5 Jun 2020 16:28:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OILMBMu3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727768AbgFEQ0V (ORCPT ); Fri, 5 Jun 2020 12:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgFEQ0P (ORCPT ); Fri, 5 Jun 2020 12:26:15 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC13C08C5C4; Fri, 5 Jun 2020 09:26:14 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ne5so322202pjb.5; Fri, 05 Jun 2020 09:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yl2c3lr1cROZ0PCJowYf2rTBlLEbdPel5A+cfI8kcRw=; b=OILMBMu3f4uUqmw7nraOQ+HIRXbapVevszh8tlqmfiI+uK/PqtzYe9i85L+n4VuTyY i8cNjmnoatRFwHVAH/OK++jMmG+J4CTJlk6fpW+PMwRz1if1C9OjWBh8G/H0Mps33wIM 8VMsbNb4SvAUNrQ8hwh8eiea3Wi3Vfz0j/rzI5Okgu3g8JmmP+SumcV67tMecck8YUV4 mHKkAsime/KB2o+3xxr7goDFmp+qUl0NLIMgfMRdBhvE6PZmCQridRRK5Rfe6ZAb/uEQ ZixzouBisij0CqukR4JA5cMW1J3qkiQtSx7HTlDHSUl3AF10Bcok8BuHR0XnKyoAE2/u g1xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yl2c3lr1cROZ0PCJowYf2rTBlLEbdPel5A+cfI8kcRw=; b=NtYivj93/JAxIRAVmXxa7HbqQoyvr2cd9J3qQGNPHJFXo165A89m8vtP15VsjTyM+G w+ijlFJP4X/ZxvdOQa6+01pN75weFd2vCDPxIahbADmj0UIxtNVv82khz9Hssbk3zUHl xUVP8iuFtshj1Geiufo6Wfn6BB/kQ7vqSgAxqgrFE6SOQFmB63PEbW4R5Q9bv+mzJI/W Y/n67jmv0ubTeLwtHvASkcJGjYXQkGfSmn/Zq51tvfkBXvHjRf9dkaYwLIbhKAxT3EJZ CVzoMpmQ7eKHDtLpFuQ8l5OTq6yLQ/hSJZNoqV+ORLeSEPcCbiLgIt9YnlSvvADYejCU DLZQ== X-Gm-Message-State: AOAM532AtDgar4H5GskV+fIye0wu9MO6A9bY1ODUncqjvJe5nuus4tnY fslQtj2orVrSUSvZyX0s1mqaoNf6 X-Google-Smtp-Source: ABdhPJzjGSSaf8Gl1ZdNII6917kbMvgnzC/3jYmA+FNfnh4K1xXdh6ldPtySdckZrVMw2T//+N5EwQ== X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr3638937pja.80.1591374373641; Fri, 05 Jun 2020 09:26:13 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:12 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 08/21] media: friio-fe: get rid of set_property() Date: Fri, 5 Jun 2020 09:25:05 -0700 Message-Id: <20200605162518.28099-9-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mauro Carvalho Chehab commit b2c41ca9632e686e79f6c9db9c5f75666d37926e upstream This callback is not actually doing anything but making it to return an error depending on the DTV frontend command. Well, that could break userspace for no good reason, and, if needed, should be implemented, instead, at set_frontend() callback. So, get rid of it. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/usb/dvb-usb/friio-fe.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/drivers/media/usb/dvb-usb/friio-fe.c b/drivers/media/usb/dvb-usb/friio-fe.c index 979f05b4b87c..237f12f9a7f2 100644 --- a/drivers/media/usb/dvb-usb/friio-fe.c +++ b/drivers/media/usb/dvb-usb/friio-fe.c @@ -261,28 +261,6 @@ static int jdvbt90502_read_signal_strength(struct dvb_frontend *fe, return 0; } - -/* filter out un-supported properties to notify users */ -static int jdvbt90502_set_property(struct dvb_frontend *fe, - struct dtv_property *tvp) -{ - int r = 0; - - switch (tvp->cmd) { - case DTV_DELIVERY_SYSTEM: - if (tvp->u.data != SYS_ISDBT) - r = -EINVAL; - break; - case DTV_CLEAR: - case DTV_TUNE: - case DTV_FREQUENCY: - break; - default: - r = -EINVAL; - } - return r; -} - static int jdvbt90502_set_frontend(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = &fe->dtv_property_cache; @@ -457,8 +435,6 @@ static struct dvb_frontend_ops jdvbt90502_ops = { .init = jdvbt90502_init, .write = _jdvbt90502_write, - .set_property = jdvbt90502_set_property, - .set_frontend = jdvbt90502_set_frontend, .read_status = jdvbt90502_read_status, From patchwork Fri Jun 5 16:25:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224745 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 EE792C433DF for ; Fri, 5 Jun 2020 16:29:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C73212074B for ; Fri, 5 Jun 2020 16:29:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B7CLR+n7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726044AbgFEQ27 (ORCPT ); Fri, 5 Jun 2020 12:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727094AbgFEQ0T (ORCPT ); Fri, 5 Jun 2020 12:26:19 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FEB8C08C5C4; Fri, 5 Jun 2020 09:26:19 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id g12so3820798pll.10; Fri, 05 Jun 2020 09:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P9QFzVDXmyF/4FAK3YhuPZVq3F8vZzWLPk9FHl2uNlY=; b=B7CLR+n7xCrM/7jGBaWosCExnekVU0GmOisXCHtPqSoYy+yNncf0PeQsqqCsYn7pmy qwelSsGwTrair18RdjQNiKk5vIiWOvq+gGaa+6jROE+qlFyLNlA6KZ84NbWNtxxD9OOK zlXfrtCnl+4/U/sYBRVQ4+kEMFgG9qnuBqy1xHAd7h3UZgXh45fEp246L7ukIDsc+pR4 Hn3zfRXtHXUP9XJ15TXVxaIQWzhe9WAT814y0Cun9vZUVvDNENUjy114GCvatc3NN9bb z4uFq0Nu8fK+1uowop7CvZ66FwpW5Eb+UHzDZkA3xejPn1WZSambm9eXut2rAhlDKu90 yEXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P9QFzVDXmyF/4FAK3YhuPZVq3F8vZzWLPk9FHl2uNlY=; b=f2eCGtPQrJwAtpG0pG5P/7PMrQxXPCAGQ4Y5IVbRuG01j3hdp7urrLMesPca8r2S+J +I3jqNAmGQwoyiTV2DCxwRqAB+ILk7K27pFWJUS/CG83YhAhdF2OE7041ItNbbBWq1Y0 Og5gOH/ow1hpTiqmQY1dP6FENp/6SCoPdXl29Lkv5qfgWiqhZTsTeoUz1/XHXGWkkEtv 9uF6oxMWy5JXcA1jK8pO0j8awEuJs8rGMg0NPn+5tG4nXP+KZhgkrEL+A4QEiF5GZS1o 7apcnrkDs6qEUxSkninFLLj+CaTYltmtksZVUFuH5YWK6WqSqDxSvqFA3DDGBsJDfob6 uOqA== X-Gm-Message-State: AOAM533ERb4rrANqQ6lkd492CCRKTAtdHZjTZkOPCWTOROAzQr7JvvAw uk4sqUYsvmZmIxnB5+EfPV+zZKwI X-Google-Smtp-Source: ABdhPJzLsTKKOuLCzSt+NPiC0yKqidFmbux2ObQg9JpxfsHKAa649lwl+xLQS+4u1vaRYtZhPh1hUQ== X-Received: by 2002:a17:902:b716:: with SMTP id d22mr9269877pls.33.1591374378165; Fri, 05 Jun 2020 09:26:18 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:17 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 10/21] media: dvb_frontend: cleanup dvb_frontend_ioctl_properties() Date: Fri, 5 Jun 2020 09:25:07 -0700 Message-Id: <20200605162518.28099-11-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mauro Carvalho Chehab commit 2b5df42b8dec69fb926a242007fd462343db4408 upstream Use a switch() on this function, just like on other ioctl handlers and handle parameters inside each part of the switch. That makes it easier to integrate with the already existing ioctl handler function. Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 83 ++++++++++++++++----------- 1 file changed, 51 insertions(+), 32 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 2bf55a786e29..c446f51be21a 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1956,21 +1956,25 @@ static int dvb_frontend_ioctl_properties(struct file *file, struct dvb_frontend *fe = dvbdev->priv; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int err = 0; - - struct dtv_properties *tvps = parg; - struct dtv_property *tvp = NULL; - int i; + int err, i; dev_dbg(fe->dvb->device, "%s:\n", __func__); - if (cmd == FE_SET_PROPERTY) { - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); + switch(cmd) { + case FE_SET_PROPERTY: { + struct dtv_properties *tvps = parg; + struct dtv_property *tvp = NULL; + + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", + __func__, tvps->num); + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", + __func__, tvps->props); - /* Put an arbitrary limit on the number of messages that can - * be sent at once */ - if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) return -EINVAL; tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); @@ -1979,23 +1983,34 @@ static int dvb_frontend_ioctl_properties(struct file *file, for (i = 0; i < tvps->num; i++) { err = dtv_property_process_set(fe, tvp + i, file); - if (err < 0) - goto out; + if (err < 0) { + kfree(tvp); + return err; + } (tvp + i)->result = err; } if (c->state == DTV_TUNE) dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__); - } else if (cmd == FE_GET_PROPERTY) { + kfree(tvp); + break; + } + case FE_GET_PROPERTY: { + struct dtv_properties *tvps = parg; + struct dtv_property *tvp = NULL; struct dtv_frontend_properties getp = fe->dtv_property_cache; - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", + __func__, tvps->num); + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", + __func__, tvps->props); - /* Put an arbitrary limit on the number of messages that can - * be sent at once */ - if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) return -EINVAL; tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); @@ -2010,28 +2025,32 @@ static int dvb_frontend_ioctl_properties(struct file *file, */ if (fepriv->state != FESTATE_IDLE) { err = dtv_get_frontend(fe, &getp, NULL); - if (err < 0) - goto out; + if (err < 0) { + kfree(tvp); + return err; + } } for (i = 0; i < tvps->num; i++) { err = dtv_property_process_get(fe, &getp, tvp + i, file); - if (err < 0) - goto out; + if (err < 0) { + kfree(tvp); + return err; + } (tvp + i)->result = err; } if (copy_to_user((void __user *)tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) { - err = -EFAULT; - goto out; + kfree(tvp); + return -EFAULT; } - - } else - err = -EOPNOTSUPP; - -out: - kfree(tvp); - return err; + kfree(tvp); + break; + } + default: + return -ENOTSUPP; + } /* switch */ + return 0; } static int dtv_set_frontend(struct dvb_frontend *fe) From patchwork Fri Jun 5 16:25:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224747 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 856C5C433E0 for ; Fri, 5 Jun 2020 16:28:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66352207D8 for ; Fri, 5 Jun 2020 16:28:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="s00v2Cjn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728497AbgFEQ1l (ORCPT ); Fri, 5 Jun 2020 12:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727834AbgFEQ0Z (ORCPT ); Fri, 5 Jun 2020 12:26:25 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6203DC08C5C2; Fri, 5 Jun 2020 09:26:25 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id v24so3825406plo.6; Fri, 05 Jun 2020 09:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BLnQZOuB1encvsP/q1TibKnbvwfFTQgmw900uUD1eh0=; b=s00v2CjnBugUosRS98w1/0sNO2ock4FIvKSRMeLbUSssi7MVlHqvLRq37Hjfdu22ms tP1LS3GniNPJjGdPKLPZVTVkFDCzLVAoaI0pMCwQHV/Ngof36A3Q+h7zeR+ccoudD/qQ MKu1OGIJQ7QCrxE7shBQmY7Qat23pA3t8ePzKPjLhon9U0+Npv6RHCdngwIw9+Eq0iGv PxEM4xr3gSFjtCrrvI2Yt3uACQLm2sRXUjffqBV4VJfm4iBP7iGNz4mz3B65CuWe2muA /gsUYtk61NiJtjU8fPiM7dotWk3b0Fuu28+xAj5o0+pvrPuihVoBj60Mv9VOW9aWucfF bfmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BLnQZOuB1encvsP/q1TibKnbvwfFTQgmw900uUD1eh0=; b=kmy1aTy+mMGMYkyYwSN4/Duc3b39SYjJuhPFdzwERSxJCVtlDcuqGYVvtpxMXVBP0j PVw0vGzNRoPuSR7FJFDYKs79Y65a3gb4Wc3YJ9luZOrEbqqb5fwZHTpzls2IoOd7AP6v tJyb0hCTYJdC1Q/sgzHmioy1NNOYpBoU5vPROZUiGRZmHx8QECm20o5L7R03vnimdWoi S6BQ6iFgE3dsGhYTyNb6+yvUhU+uQtyDD/8hX3h1MgozeJbcE68T0ACWeXTfcsVtZDQP KdiHvSIffaZj9NgyMwPhCpo1L4NYonBLzq7Li+iiwVVHrk7rFSSSZoy+tMokFUN3aHWb /BZg== X-Gm-Message-State: AOAM533IU8Mts4H0c8VXW98H80oXQj7cxgxMve7Yo+kJfWc77qBkbXMC FFkS5kJyLdIrv6eRL9XrXpggCdOv X-Google-Smtp-Source: ABdhPJz0cVn1eGekoeOqU4W06zaqiKvd2KFHArWEsQz0WH9fUXfaO5hFFKYjAhl9h/p0Nup6qACHKQ== X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr3639794pja.80.1591374384508; Fri, 05 Jun 2020 09:26:24 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:23 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 13/21] media: dvb_frontend: better document the -EPERM condition Date: Fri, 5 Jun 2020 09:25:10 -0700 Message-Id: <20200605162518.28099-14-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mauro Carvalho Chehab commit da5516b5e81d45a96291823620f6c820178dc055 upstream Two readonly ioctls can't be allowed if the frontend device is opened in read only mode. Explain why. Reviewed by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index a7ba8e200b67..673cefb7230c 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1925,9 +1925,23 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) return -ENODEV; } - if ((file->f_flags & O_ACCMODE) == O_RDONLY && - (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT || - cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { + /* + * If the frontend is opened in read-only mode, only the ioctls + * that don't interfere with the tune logic should be accepted. + * That allows an external application to monitor the DVB QoS and + * statistics parameters. + * + * That matches all _IOR() ioctls, except for two special cases: + * - FE_GET_EVENT is part of the tuning logic on a DVB application; + * - FE_DISEQC_RECV_SLAVE_REPLY is part of DiSEqC 2.0 + * setup + * So, those two ioctls should also return -EPERM, as otherwise + * reading from them would interfere with a DVB tune application + */ + if ((file->f_flags & O_ACCMODE) == O_RDONLY + && (_IOC_DIR(cmd) != _IOC_READ + || cmd == FE_GET_EVENT + || cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { up(&fepriv->sem); return -EPERM; } From patchwork Fri Jun 5 16:25:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224748 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 364E1C433DF for ; Fri, 5 Jun 2020 16:27:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11EB82074B for ; Fri, 5 Jun 2020 16:27:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kVNXoR7j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728151AbgFEQ1X (ORCPT ); Fri, 5 Jun 2020 12:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727960AbgFEQ0a (ORCPT ); Fri, 5 Jun 2020 12:26:30 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF578C08C5C3; Fri, 5 Jun 2020 09:26:29 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id r10so5335733pgv.8; Fri, 05 Jun 2020 09:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+N3kHSDVqsZFY1+BCJ77exstXC1iacuDolQw5ImyaQI=; b=kVNXoR7jUWvZV/msL11C9fbekmco3642TFubX0dWjh6lDrDHirKHkcY6dO19O56c+h RtjFWh9cjQf00mWUUc8xslHZNWdQQIMi9Mjoh/BN143lUNMN+pTRZHAqIB9tabqCbuaZ tJzNhAUfnJAg/VmNAH178wr4lqs3rvXlM/c2pqk0GBze5R+3o1kwKtPuhPCF9Z8OaRZa aIItA4fJEDhQ6wYSllzILB5GsAIIv82A+Yj86tCvHOvDfWrEOOT3Hs4AHa2eNErnkkQA kbaMFEuWLrMdIY/hm08P+WxEkfhwe0OLoVha79XxrrgIzVOQV9W20ph1gF3up0E/BRMp 79Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+N3kHSDVqsZFY1+BCJ77exstXC1iacuDolQw5ImyaQI=; b=gS3Jb7/lHoPpneQc6pc71DtRbfgnBhf7eOV+khoxE+Tktnk8BFmGJvqaT0xZluPddt DxC0XXMwfdm7q+Zlalq4vbMt9mU6zW1thrhj9JGAJYcoELRgjkXA/wHftSS+RRmGU/nW wRMTXdnBB9VLXthqZ4KdqffPohl6WVJRm0Gi2t5A10reWq7Elzl4PBGzpf1cr3S9ibwl +1ntNb4Yf2n1+byCfPQikfU2tMHDu9FzRQ6XvNVyIpCUUvSZIpEnWQ9xynZ445OSnBQz 38NrLzK47vbGTTGKzfGlYctAOe0wxPAlqBAQDJiE37gAzbHus9AUi1L5TyEG9mjI4Vk1 mlOA== X-Gm-Message-State: AOAM533DKg6HMHAF++DHNxS9bvwbOH/ytXCsA/gd2O9TwaMhrP6bitfh wAesygXblAB+bDIj1vnxCq5ngct7 X-Google-Smtp-Source: ABdhPJyk+hTQeHsRrR7Z4Qwxfy7FC+HeakH0C66nlgKJ0BthdauidvpXSGEw06q35gNh5jA6XnCTlA== X-Received: by 2002:a62:4e83:: with SMTP id c125mr11030510pfb.165.1591374388926; Fri, 05 Jun 2020 09:26:28 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:28 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Satendra Singh Thakur , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 15/21] media: dvb_frontend: dtv_property_process_set() cleanups Date: Fri, 5 Jun 2020 09:25:12 -0700 Message-Id: <20200605162518.28099-16-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Satendra Singh Thakur commit media: dvb_frontend: dtv_property_process_set() cleanups upstream Since all properties in the func dtv_property_process_set() use at most 4 bytes arguments, change the code to pass u32 cmd and u32 data as function arguments, instead of passing a pointer to the entire struct dtv_property *tvp. Instead of having a generic dtv_property_dump(), added its own properties debug logic in the dtv_property_process_set(). Signed-off-by: Satendra Singh Thakur Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 125 +++++++++++++++----------- 1 file changed, 72 insertions(+), 53 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index ca4959bbb6c2..a9ae9e509205 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1088,22 +1088,19 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_STAT_TOTAL_BLOCK_COUNT, 0, 0), }; -static void dtv_property_dump(struct dvb_frontend *fe, - bool is_set, +static void dtv_get_property_dump(struct dvb_frontend *fe, struct dtv_property *tvp) { int i; if (tvp->cmd <= 0 || tvp->cmd > DTV_MAX_COMMAND) { - dev_warn(fe->dvb->device, "%s: %s tvp.cmd = 0x%08x undefined\n", - __func__, - is_set ? "SET" : "GET", + dev_warn(fe->dvb->device, "%s: GET tvp.cmd = 0x%08x undefined\n" + , __func__, tvp->cmd); return; } - dev_dbg(fe->dvb->device, "%s: %s tvp.cmd = 0x%08x (%s)\n", __func__, - is_set ? "SET" : "GET", + dev_dbg(fe->dvb->device, "%s: GET tvp.cmd = 0x%08x (%s)\n", __func__, tvp->cmd, dtv_cmds[tvp->cmd].name); @@ -1513,7 +1510,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe, return -EINVAL; } - dtv_property_dump(fe, false, tvp); + dtv_get_property_dump(fe, tvp); return 0; } @@ -1740,16 +1737,36 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe) return emulate_delivery_system(fe, delsys); } +/** + * dtv_property_process_set - Sets a single DTV property + * @fe: Pointer to &struct dvb_frontend + * @file: Pointer to &struct file + * @cmd: Digital TV command + * @data: An unsigned 32-bits number + * + * This routine assigns the property + * value to the corresponding member of + * &struct dtv_frontend_properties + * + * Returns: + * Zero on success, negative errno on failure. + */ static int dtv_property_process_set(struct dvb_frontend *fe, - struct dtv_property *tvp, - struct file *file) + struct file *file, + u32 cmd, u32 data) { int r = 0; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - dtv_property_dump(fe, true, tvp); - - switch(tvp->cmd) { + /** Dump DTV command name and value*/ + if (!cmd || cmd > DTV_MAX_COMMAND) + dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n", + __func__, cmd); + else + dev_dbg(fe->dvb->device, + "%s: SET cmd 0x%08x (%s) to 0x%08x\n", + __func__, cmd, dtv_cmds[cmd].name, data); + switch (cmd) { case DTV_CLEAR: /* * Reset a cache of data specific to the frontend here. This does @@ -1769,133 +1786,133 @@ static int dtv_property_process_set(struct dvb_frontend *fe, r = dtv_set_frontend(fe); break; case DTV_FREQUENCY: - c->frequency = tvp->u.data; + c->frequency = data; break; case DTV_MODULATION: - c->modulation = tvp->u.data; + c->modulation = data; break; case DTV_BANDWIDTH_HZ: - c->bandwidth_hz = tvp->u.data; + c->bandwidth_hz = data; break; case DTV_INVERSION: - c->inversion = tvp->u.data; + c->inversion = data; break; case DTV_SYMBOL_RATE: - c->symbol_rate = tvp->u.data; + c->symbol_rate = data; break; case DTV_INNER_FEC: - c->fec_inner = tvp->u.data; + c->fec_inner = data; break; case DTV_PILOT: - c->pilot = tvp->u.data; + c->pilot = data; break; case DTV_ROLLOFF: - c->rolloff = tvp->u.data; + c->rolloff = data; break; case DTV_DELIVERY_SYSTEM: - r = dvbv5_set_delivery_system(fe, tvp->u.data); + r = dvbv5_set_delivery_system(fe, data); break; case DTV_VOLTAGE: - c->voltage = tvp->u.data; + c->voltage = data; r = dvb_frontend_handle_ioctl(file, FE_SET_VOLTAGE, (void *)c->voltage); break; case DTV_TONE: - c->sectone = tvp->u.data; + c->sectone = data; r = dvb_frontend_handle_ioctl(file, FE_SET_TONE, (void *)c->sectone); break; case DTV_CODE_RATE_HP: - c->code_rate_HP = tvp->u.data; + c->code_rate_HP = data; break; case DTV_CODE_RATE_LP: - c->code_rate_LP = tvp->u.data; + c->code_rate_LP = data; break; case DTV_GUARD_INTERVAL: - c->guard_interval = tvp->u.data; + c->guard_interval = data; break; case DTV_TRANSMISSION_MODE: - c->transmission_mode = tvp->u.data; + c->transmission_mode = data; break; case DTV_HIERARCHY: - c->hierarchy = tvp->u.data; + c->hierarchy = data; break; case DTV_INTERLEAVING: - c->interleaving = tvp->u.data; + c->interleaving = data; break; /* ISDB-T Support here */ case DTV_ISDBT_PARTIAL_RECEPTION: - c->isdbt_partial_reception = tvp->u.data; + c->isdbt_partial_reception = data; break; case DTV_ISDBT_SOUND_BROADCASTING: - c->isdbt_sb_mode = tvp->u.data; + c->isdbt_sb_mode = data; break; case DTV_ISDBT_SB_SUBCHANNEL_ID: - c->isdbt_sb_subchannel = tvp->u.data; + c->isdbt_sb_subchannel = data; break; case DTV_ISDBT_SB_SEGMENT_IDX: - c->isdbt_sb_segment_idx = tvp->u.data; + c->isdbt_sb_segment_idx = data; break; case DTV_ISDBT_SB_SEGMENT_COUNT: - c->isdbt_sb_segment_count = tvp->u.data; + c->isdbt_sb_segment_count = data; break; case DTV_ISDBT_LAYER_ENABLED: - c->isdbt_layer_enabled = tvp->u.data; + c->isdbt_layer_enabled = data; break; case DTV_ISDBT_LAYERA_FEC: - c->layer[0].fec = tvp->u.data; + c->layer[0].fec = data; break; case DTV_ISDBT_LAYERA_MODULATION: - c->layer[0].modulation = tvp->u.data; + c->layer[0].modulation = data; break; case DTV_ISDBT_LAYERA_SEGMENT_COUNT: - c->layer[0].segment_count = tvp->u.data; + c->layer[0].segment_count = data; break; case DTV_ISDBT_LAYERA_TIME_INTERLEAVING: - c->layer[0].interleaving = tvp->u.data; + c->layer[0].interleaving = data; break; case DTV_ISDBT_LAYERB_FEC: - c->layer[1].fec = tvp->u.data; + c->layer[1].fec = data; break; case DTV_ISDBT_LAYERB_MODULATION: - c->layer[1].modulation = tvp->u.data; + c->layer[1].modulation = data; break; case DTV_ISDBT_LAYERB_SEGMENT_COUNT: - c->layer[1].segment_count = tvp->u.data; + c->layer[1].segment_count = data; break; case DTV_ISDBT_LAYERB_TIME_INTERLEAVING: - c->layer[1].interleaving = tvp->u.data; + c->layer[1].interleaving = data; break; case DTV_ISDBT_LAYERC_FEC: - c->layer[2].fec = tvp->u.data; + c->layer[2].fec = data; break; case DTV_ISDBT_LAYERC_MODULATION: - c->layer[2].modulation = tvp->u.data; + c->layer[2].modulation = data; break; case DTV_ISDBT_LAYERC_SEGMENT_COUNT: - c->layer[2].segment_count = tvp->u.data; + c->layer[2].segment_count = data; break; case DTV_ISDBT_LAYERC_TIME_INTERLEAVING: - c->layer[2].interleaving = tvp->u.data; + c->layer[2].interleaving = data; break; /* Multistream support */ case DTV_STREAM_ID: case DTV_DVBT2_PLP_ID_LEGACY: - c->stream_id = tvp->u.data; + c->stream_id = data; break; /* ATSC-MH */ case DTV_ATSCMH_PARADE_ID: - fe->dtv_property_cache.atscmh_parade_id = tvp->u.data; + fe->dtv_property_cache.atscmh_parade_id = data; break; case DTV_ATSCMH_RS_FRAME_ENSEMBLE: - fe->dtv_property_cache.atscmh_rs_frame_ensemble = tvp->u.data; + fe->dtv_property_cache.atscmh_rs_frame_ensemble = data; break; case DTV_LNA: - c->lna = tvp->u.data; + c->lna = data; if (fe->ops.set_lna) r = fe->ops.set_lna(fe); if (r < 0) @@ -2122,7 +2139,9 @@ static int dvb_frontend_handle_ioctl(struct file *file, return PTR_ERR(tvp); for (i = 0; i < tvps->num; i++) { - err = dtv_property_process_set(fe, tvp + i, file); + err = dtv_property_process_set(fe, file, + (tvp + i)->cmd, + (tvp + i)->u.data); if (err < 0) { kfree(tvp); return err; From patchwork Fri Jun 5 16:25:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224750 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 9FA44C433E0 for ; Fri, 5 Jun 2020 16:27:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D212207ED for ; Fri, 5 Jun 2020 16:27:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nUIJaYZY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727913AbgFEQ0k (ORCPT ); Fri, 5 Jun 2020 12:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728072AbgFEQ0e (ORCPT ); Fri, 5 Jun 2020 12:26:34 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C06C08C5C5; Fri, 5 Jun 2020 09:26:34 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id r10so5335895pgv.8; Fri, 05 Jun 2020 09:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fueseL5wyjqHmp/EINkLjCle5ZJWz4SZll2cBBMMoIo=; b=nUIJaYZYkrn+NijNw3IyxCjOJU7xMm84eMHKy5wvWH2Pr2v5seb962AJ3NwN9SWUSk 3pbjkA7z7X5fda0JvTeq08VTwcdnLkJ9WOn67TT2dGvh4ZYiV1OhKuTOzAy5tm8yZqno hDabC4RfeKq3Wsj+qWUrFfl7k0pXzSJTK0ry+bECrK/nqHoOF4nM8vGlLbbIkfZrwYkO EIGLIamOTOIVerTnozi2L5k9f7308f2j2sJbHJ0kMnF4ZhnTAtJgFvL78dk3rWpvGWHD eWUuu0qWvDCYS08dZ/Up3OygMkLZITyIDr06L4NWlJrgurA/oYFtq8qMZXvktBnyK1oh fbbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fueseL5wyjqHmp/EINkLjCle5ZJWz4SZll2cBBMMoIo=; b=KfDR5TW7I3g1M8PGV4ii75RS6jCq9rxZBA8Eq9djwoWGRnC0rqumNCaqBtRBNoTMii 9ncy98gE9jmP4BaN2p/1aV6SZO1YvVRoVmyRdzEscFzCqiwNulis+nEqNsdEm3NFmbJL wtdGt93ATMkuVfiLoRNWWhJI0pFpQA2CVkiKQJdcCIwMjdOMaQ7aU4Xaf2fm5gUrKETx OavjVsr22u9jf3yZJfIpOKzCOYZNLedudqetlL3SjqUpxdReA7SgvA4svhfoTPrrHXLJ hN/JicyPBlyKkjRenjjch19nd4pEQboBbmWWJTFIl7jpN4wVWdwfopAUu3/ZGpjJiquD EQLg== X-Gm-Message-State: AOAM531swIbXvToPjIRCJlYYQaIGool41TeFD2Z3ZR4RfQb7w8gWMiPO 7Ofs0wKboYMEDPBGvn4lj4Rhf+NS X-Google-Smtp-Source: ABdhPJzDKmT6IpB88utVE+CnCj6Mz/rXrSRYIZWebzvHb8KFaCquBtHj9sUHxWPIoy8dlgHvpiU+iQ== X-Received: by 2002:a62:5346:: with SMTP id h67mr9899045pfb.284.1591374393527; Fri, 05 Jun 2020 09:26:33 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:32 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Jaedon Shin , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 17/21] media: dvb_frontend: Add unlocked_ioctl in dvb_frontend.c Date: Fri, 5 Jun 2020 09:25:14 -0700 Message-Id: <20200605162518.28099-18-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaedon Shin commit a2282fd1fe2ebcda480426dbfaaa7c4e87e27399 upstream Adds unlocked ioctl function directly in dvb_frontend.c instead of using dvb_generic_ioctl(). Signed-off-by: Jaedon Shin Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 6f9ee78a1870..dacc467e24af 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1926,7 +1926,8 @@ static int dtv_property_process_set(struct dvb_frontend *fe, return r; } -static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) +static int dvb_frontend_do_ioctl(struct file *file, unsigned int cmd, + void *parg) { struct dvb_device *dvbdev = file->private_data; struct dvb_frontend *fe = dvbdev->priv; @@ -1969,6 +1970,17 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) return err; } +static long dvb_frontend_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct dvb_device *dvbdev = file->private_data; + + if (!dvbdev) + return -ENODEV; + + return dvb_usercopy(file, cmd, arg, dvb_frontend_do_ioctl); +} + static int dtv_set_frontend(struct dvb_frontend *fe) { struct dvb_frontend_private *fepriv = fe->frontend_priv; @@ -2638,7 +2650,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) static const struct file_operations dvb_frontend_fops = { .owner = THIS_MODULE, - .unlocked_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_frontend_ioctl, .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release, @@ -2706,7 +2718,6 @@ int dvb_register_frontend(struct dvb_adapter* dvb, #if defined(CONFIG_MEDIA_CONTROLLER_DVB) .name = fe->ops.info.name, #endif - .kernel_ioctl = dvb_frontend_ioctl }; dev_dbg(dvb->device, "%s:\n", __func__); From patchwork Fri Jun 5 16:25:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224749 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 CD755C433E0 for ; Fri, 5 Jun 2020 16:27:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB81B2077D for ; Fri, 5 Jun 2020 16:27:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ktvPYPKo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728163AbgFEQ0j (ORCPT ); Fri, 5 Jun 2020 12:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728138AbgFEQ0h (ORCPT ); Fri, 5 Jun 2020 12:26:37 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B8B7C08C5C3; Fri, 5 Jun 2020 09:26:36 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id z64so5144257pfb.1; Fri, 05 Jun 2020 09:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/M5A1guudu8CJXvZtpOIJo9xlxZZgKSUXm5P8/pYAgw=; b=ktvPYPKo3lZjaa3dRu9oHGaxP9fF/hUHb3ButlgFIiamBO6VJkMuN++ASu1azTunoX 96CLz7jT8Kqe8Sp6J0aZWzodqkgpjHTq0Qh2joGS37Z0BmBlfgpk4PPqlLSzaBIASSJF M9xYNx2c2PHJU0nCp9bQ6mEoODz8S1doLSON2Y+oIqvdy8EbP03jr0C1+/3NS0mRAOym QIJSQyBWr60tvvnUtO57ihuycjxQR6L5WhS3cUl61MxpY3F0SForJK4LuELvxXUlltYm JRH21Kz7Gmy0Ke1EV/aysGW8ii+KFPbz5VetBeyVJSggT3zE6ucx52JAv3a2lB1Pp5nP a3Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/M5A1guudu8CJXvZtpOIJo9xlxZZgKSUXm5P8/pYAgw=; b=VIbV6BmD8qwoeESR48HZpzxA4K6d3QL0MdoG20PHcZSkaJu0noQW7nZxikw4Vg6UXW QyYbGRizVj0Je4TTqymtq4qXxxBpwWUVqdZ6v+2GRaiTI2bojtAiNDCN9QAOaPKlNP4z 8eIkb1Ie68Wq+8d9YgnaVbWb5G3l7a165jCcouOCezkSCZ1nYArX2oGUuIlPUyagjHg6 WWn/P+8Y266ndfc+nzbf3MDFM267ZGFCx/COTw/DfRYCtbJ9LwTuKn+9KDGlVg+SOtTR oE4wfq4wJzQtH6y1wACz4G2j5S49V/YnyP6kdJ78xuEcHIPc62rTbIrW2T72ObUZyxBF tlpA== X-Gm-Message-State: AOAM5327wlTxTaIRjzs+JtGZTyoS07Ro0Vs9UoCAo0IN3nYv8mTD2aEv CpYjQ9C+tzRoKIIYZY2+qjd0WVy0 X-Google-Smtp-Source: ABdhPJxfnzKdAvBSAn2DGkGIAXsIn/7shQxn4bh6bG94ttICeG0q1VJlLp3bAV9SKpv105SrRyf2UQ== X-Received: by 2002:aa7:95bd:: with SMTP id a29mr10342882pfk.57.1591374395681; Fri, 05 Jun 2020 09:26:35 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:34 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Jaedon Shin , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 18/21] media: dvb_frontend: Add compat_ioctl callback Date: Fri, 5 Jun 2020 09:25:15 -0700 Message-Id: <20200605162518.28099-19-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaedon Shin commit c2dfd2276cec63a0c6f6ce18ed83800d96fde542 upstream Adds compat_ioctl for 32-bit user space applications on a 64-bit system. [m.chehab@osg.samsung.com: add missing include compat.h] Signed-off-by: Jaedon Shin Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 12 ++++++++++++ fs/compat_ioctl.c | 17 ----------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index dacc467e24af..c0a25cd6ccb8 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "dvb_frontend.h" @@ -1981,6 +1982,14 @@ static long dvb_frontend_ioctl(struct file *file, unsigned int cmd, return dvb_usercopy(file, cmd, arg, dvb_frontend_do_ioctl); } +#ifdef CONFIG_COMPAT +static long dvb_frontend_compat_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + return dvb_frontend_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int dtv_set_frontend(struct dvb_frontend *fe) { struct dvb_frontend_private *fepriv = fe->frontend_priv; @@ -2651,6 +2660,9 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) static const struct file_operations dvb_frontend_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dvb_frontend_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = dvb_frontend_compat_ioctl, +#endif .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 02ac9067a354..9fa3285425fe 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1340,23 +1340,6 @@ COMPATIBLE_IOCTL(DMX_GET_PES_PIDS) COMPATIBLE_IOCTL(DMX_GET_CAPS) COMPATIBLE_IOCTL(DMX_SET_SOURCE) COMPATIBLE_IOCTL(DMX_GET_STC) -COMPATIBLE_IOCTL(FE_GET_INFO) -COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD) -COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD) -COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY) -COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST) -COMPATIBLE_IOCTL(FE_SET_TONE) -COMPATIBLE_IOCTL(FE_SET_VOLTAGE) -COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE) -COMPATIBLE_IOCTL(FE_READ_STATUS) -COMPATIBLE_IOCTL(FE_READ_BER) -COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH) -COMPATIBLE_IOCTL(FE_READ_SNR) -COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS) -COMPATIBLE_IOCTL(FE_SET_FRONTEND) -COMPATIBLE_IOCTL(FE_GET_FRONTEND) -COMPATIBLE_IOCTL(FE_GET_EVENT) -COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD) COMPATIBLE_IOCTL(VIDEO_STOP) COMPATIBLE_IOCTL(VIDEO_PLAY) COMPATIBLE_IOCTL(VIDEO_FREEZE) From patchwork Fri Jun 5 16:25:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 224751 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 E2991C433E0 for ; Fri, 5 Jun 2020 16:26:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C225E2075B for ; Fri, 5 Jun 2020 16:26:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q1bTgBJ8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728275AbgFEQ0n (ORCPT ); Fri, 5 Jun 2020 12:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbgFEQ0l (ORCPT ); Fri, 5 Jun 2020 12:26:41 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20648C08C5C2; Fri, 5 Jun 2020 09:26:41 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ne5so323358pjb.5; Fri, 05 Jun 2020 09:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jV4daFGWsjhFnvffgzn/EdlePMcCRTFOIwlzfJCB7vg=; b=Q1bTgBJ8HMzy/86+TG56pOicptFiM5AtNDIh0w9tYHpnfvbs7cIaCjosUGRfiO+jpA IoAN0M+oDA1aRUo5+iNjk6/yR8QHpv8s1tqMtoc1LqgUOmB6HLLn/oB7SoD88wUvHbIM ooVEc16/+UmDtik4ehrqrjGy3822X2i7e1AE3eQZ8uV4qOQG7t1rNQMJJV29jTCH/zTL vNTS7kWubY0CWdV5jTt8w801IOuCN6a8D8gLmlZ9oluErqwc1YpWeNQLTLstTLMf1kLy XUKwL2XQ1wMgR2giDakXUC2aA5b46r8Z7VJTQbCuhPMU75Uz14/ccCWgxKGskuErRGfg uNZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jV4daFGWsjhFnvffgzn/EdlePMcCRTFOIwlzfJCB7vg=; b=DhCppuI+2a0b/gUW7XKXgIANybB2mICU6v6gleA7NY6jN9vxt47Sz7wQzvwPpaJDjl C4HyrE8qcAW1skralf8IiXGYcC+TKl5Fe6OCor8lc+Rubu10qj+JqpGRQp4MGfCzHdrc rtpjZHpUUL2WQcmsRQDpP5FjoWk8FN/gWgkgjkDHAZ0t16xiEcuulA1BsSmlTHbJImbs Im3ujcFI2nVRxC/yUGAcOSqwoD9HMkbT3gk0NQGMr71/0D4ZaCtmiE+K5bi6MfeiQA65 bmZIfisLMvuvrd2jIaPXS3PV94i54lR7A/IF7Ger+OPqvZsBj6suavb48gmlacwwdPPY qPXg== X-Gm-Message-State: AOAM530Mn6ypGBD4YrCgFZcVMVED+o2HeAcq/wGp6H2WutSyKthvMzv5 g33d9USBIuTfWLTPkDQIDB0a7bOh X-Google-Smtp-Source: ABdhPJyfwzO5S6XEAP00SbLLtWAexdM+5vcogfl2B+Tnm13qnaE41Xn9B+pv7ADE7jfI2wyBG8GV0w== X-Received: by 2002:a17:90a:3321:: with SMTP id m30mr3985903pjb.20.1591374400291; Fri, 05 Jun 2020 09:26:40 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:39 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Katsuhiro Suzuki , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 20/21] media: dvb_frontend: fix wrong cast in compat_ioctl Date: Fri, 5 Jun 2020 09:25:17 -0700 Message-Id: <20200605162518.28099-21-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Katsuhiro Suzuki commit 5c6c9c4830b76d851d38829611b3c3e4be0f5cdf upstream FE_GET_PROPERTY has always failed as following situations: - Use compatible ioctl - The array of 'struct dtv_property' has 2 or more items This patch fixes wrong cast to a pointer 'struct dtv_property' from a pointer of 2nd or after item of 'struct compat_dtv_property' array. Signed-off-by: Katsuhiro Suzuki Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 34f55a2ba071..740dedf03361 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2081,7 +2081,7 @@ static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd, } for (i = 0; i < tvps->num; i++) { err = dtv_property_process_get( - fe, &getp, (struct dtv_property *)tvp + i, file); + fe, &getp, (struct dtv_property *)(tvp + i), file); if (err < 0) { kfree(tvp); return err;