From patchwork Wed Jul 4 09:48:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10506363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6228560325 for ; Wed, 4 Jul 2018 09:49:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5736028CCA for ; Wed, 4 Jul 2018 09:49:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B0A328D1B; Wed, 4 Jul 2018 09:49:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4A7028CCA for ; Wed, 4 Jul 2018 09:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753367AbeGDJs7 (ORCPT ); Wed, 4 Jul 2018 05:48:59 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:56610 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753046AbeGDJs6 (ORCPT ); Wed, 4 Jul 2018 05:48:58 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w649ifCE079628; Wed, 4 Jul 2018 09:48:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=jVJwOSGSheRLR6KR+Rc6vRsYJYmTucq4L/MdftfVSlI=; b=Dgzsgscvf2PPTyqMw2ueKM85d8gnJ7QLOQxgtOffjn5f4bQXVrynLijNAHo85PNM1XRS VfCSMUp7NJiaVps7x0aKOzhrEqae+90Lo5oV1hI8glISXkJBYr7JXXgtA8UFkA6IavhD w4mij6f+l8Gjr4PF5M/OI2K3U+F1LfrBJru7v8AFylwkzu7PpwsZaxxRkFJJn0LcGAHb JIbcetfqMeuCuW2jXJxDaex3Do4+UiUIajCpWtwfTHIGLNKGQPARkXWA29pa/FJwu4ol kavmhl0JL2Zi6GP39l5MGyeG1g62eAqBQWCPnpSykEa08mvtytAxRfRHWPRVI4ghjwxl 9w== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2k0dnt24kc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Jul 2018 09:48:45 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w649mii3010406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Jul 2018 09:48:45 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w649mhK6025971; Wed, 4 Jul 2018 09:48:43 GMT Received: from kili.mountain (/197.157.34.168) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 04 Jul 2018 02:48:42 -0700 Date: Wed, 4 Jul 2018 12:48:35 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Jasmin Jessich , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] media: dvb_ca_en50221: off by one in dvb_ca_en50221_io_do_ioctl() Message-ID: <20180704094835.vzfqt44sqaga6aia@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8943 signatures=668704 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=712 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807040116 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The > should be >= so we don't read one element beyond the end of the ca->slot_info[] array. The array is allocated in dvb_ca_en50221_init(). Signed-off-by: Dan Carpenter Acked-by: Jasmin Jessich diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c index 1310526b0d49..4d371cea0d5d 100644 --- a/drivers/media/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb-core/dvb_ca_en50221.c @@ -1391,7 +1391,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file, struct dvb_ca_slot *sl; slot = info->num; - if ((slot > ca->slot_count) || (slot < 0)) { + if ((slot >= ca->slot_count) || (slot < 0)) { err = -EINVAL; goto out_unlock; }