Received: by 10.192.165.148 with SMTP id m20csp471imm; Thu, 26 Apr 2018 14:43:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZosnbmcESMeBUShGR/gSLs8TpDR5kVp0xQOk7Ghr6PfzAT8Zd4PKPu20TP2pcMlsUgdWDTx X-Received: by 2002:a17:902:b2c7:: with SMTP id x7-v6mr9817726plw.61.1524779038215; Thu, 26 Apr 2018 14:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524779038; cv=none; d=google.com; s=arc-20160816; b=dFb2jqyb7cBAiiUJiebuW750i45rt0jX/G6NNICRq/6D9LSpD5Xhv7qSTT/qFAkgcS 0CggCziQiLwrKUp8qbONRriwW93T4gIhs6CRXez7fqeXYMRRFzNXzDOI2KTr1cu3/Coh LREzkggGXRdw6dAUwU9To/iNP5eTTilC6BdkC1FIB1L2P6JVwGKbQKKRItCJbik7vDvN hG/D8SIxAIDtK8M3Lk7BmeU7XKXzhcrXeE8rNWvea47aOW6kQUtuZRQCY9zZI7qokA64 78a8ncJpywVfH6tYgbTt0aoL2bZakI0XSoP/A5VTvKB7EMdGqi+eCQZLR0EUC0YVzHS8 vDBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=wqK8ntMkA07rHTIxgTwzK8xObR9hbtlWt3zPbv5nPT0=; b=F77hqoEC7PxXbhkEiwerR+Y2MF7rILs1RsdDB2O1q8aJTHnN8f5jINAcQlejpmioJS A8QpiJjq5ZlgUrWsrVcyP52xaot6YAaNK0NITG08tEJHgsXJbvgAE9uzcbcOBQjVs7l7 qt+3dQfDe3Q7jIcZ2S74SKDxhDNUO7gGsOHVe9bja78aQmRqgYMN5mn7E+QAPIFpC43w cSsB/m7ke0uiW1YQxbnuofo0Ux7fabBYvxY68h3RKLj11BBesvGAmyuvm9xt0wzTEHbc Lj/UfE+xS3oCtYf47V6wWSyYkVOzYzMNY9TFQs4wv9zoVcxYs6US/Mj+m4LttNsI0XaV 9ZGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 94-v6si19955069plb.475.2018.04.26.14.43.44; Thu, 26 Apr 2018 14:43:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756912AbeDZVmF (ORCPT + 99 others); Thu, 26 Apr 2018 17:42:05 -0400 Received: from gateway34.websitewelcome.com ([192.185.149.222]:14008 "EHLO gateway34.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754611AbeDZVmE (ORCPT ); Thu, 26 Apr 2018 17:42:04 -0400 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway34.websitewelcome.com (Postfix) with ESMTP id CCB9A735AA for ; Thu, 26 Apr 2018 16:42:02 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id BoeQfZibBA3CSBoeQffEDE; Thu, 26 Apr 2018 16:42:02 -0500 X-Authority-Reason: nr=8 Received: from 187-162-252-93.static.axtel.net ([187.162.252.93]:33820 helo=[192.168.15.106]) by gator4166.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1fBoeP-0029vW-Fz; Thu, 26 Apr 2018 16:42:01 -0500 Subject: Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1 To: Mauro Carvalho Chehab Cc: Dan Carpenter , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <3d4973141e218fb516422d3d831742d55aaa5c04.1524499368.git.gustavo@embeddedor.com> <20180423152455.363d285c@vento.lan> <3ab9c4c9-0656-a08e-740e-394e2e509ae9@embeddedor.com> <20180423161742.66f939ba@vento.lan> From: "Gustavo A. R. Silva" Message-ID: <99e158c0-1273-2500-da9e-b5ab31cba889@embeddedor.com> Date: Thu, 26 Apr 2018 16:41:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180423161742.66f939ba@vento.lan> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 187.162.252.93 X-Source-L: No X-Exim-ID: 1fBoeP-0029vW-Fz X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 187-162-252-93.static.axtel.net ([192.168.15.106]) [187.162.252.93]:33820 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 4 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mauro, On 04/23/2018 02:17 PM, Mauro Carvalho Chehab wrote: > Em Mon, 23 Apr 2018 14:11:02 -0500 > > Thanks, I 'll mark this series as rejected at patchwork.linuxtv.org. > Please feel free to resubmit any patch if they represent a real > threat, adding a corresponding description about the threat scenario > at the body of the e-mail. > >> Sorry for the noise and thanks for the feedback. > > Anytime. > I noticed you changed the status of this series from rejected to new. Also, there are other similar issues in media/pci/ I can write proper patches for all of them if you agree those are not False Positives: diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index 80b902b..63f4388 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -36,6 +36,8 @@ #include #include +#include + u16 cx18_service2vbi(int type) { switch (type) { @@ -488,8 +490,9 @@ static int cx18_enum_fmt_vid_cap(struct file *file, void *fh, }, }; - if (fmt->index > ARRAY_SIZE(formats) - 1) + if (fmt->index >= ARRAY_SIZE(formats)) return -EINVAL; + fmt->index = array_index_nospec(fmt->index, ARRAY_SIZE(formats)); *fmt = formats[fmt->index]; return 0; } diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 1a50ec9..d93cf09 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -30,6 +30,8 @@ #include #include +#include + /* ------------------------------------------------------------------ */ unsigned int video_debug; @@ -1819,6 +1821,8 @@ static int saa7134_enum_fmt_vid_cap(struct file *file, void *priv, if (f->index >= FORMATS) return -EINVAL; + f->index = array_index_nospec(f->index, FORMATS); + strlcpy(f->description, formats[f->index].name, sizeof(f->description)); diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 8c1f4a0..a6cfb4b 100644 --- a/drivers/media/pci/tw68/tw68-video.c #include #include +#include + #include "tw68.h" #include "tw68-reg.h" @@ -789,6 +791,8 @@ static int tw68_enum_fmt_vid_cap(struct file *file, void *priv, if (f->index >= FORMATS) return -EINVAL; + f->index = array_index_nospec(f->index, FORMATS); + strlcpy(f->description, formats[f->index].name, sizeof(f->description)); diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index c3fafa9..281d722 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -25,6 +25,8 @@ #include "tw686x.h" #include "tw686x-regs.h" +#include + #define TW686X_INPUTS_PER_CH 4 #define TW686X_VIDEO_WIDTH 720 #define TW686X_VIDEO_HEIGHT(id) ((id & V4L2_STD_525_60) ? 480 : 576) @@ -981,6 +983,7 @@ static int tw686x_enum_fmt_vid_cap(struct file *file, void *priv, { if (f->index >= ARRAY_SIZE(formats)) return -EINVAL; + f->index = array_index_nospec(f->index, ARRAY_SIZE(formats)); f->pixelformat = formats[f->index].fourcc; return 0; } Thanks -- Gustavo