Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3426518imu; Sun, 11 Nov 2018 14:50:30 -0800 (PST) X-Google-Smtp-Source: AJdET5ff7hE7h19rZI07YFeXA7UCSsns5q9kXfSRBB4vfIUasMF31ByE4hDrXzkXB3ZLe59tZ8w0 X-Received: by 2002:a63:104d:: with SMTP id 13mr15397202pgq.303.1541976630014; Sun, 11 Nov 2018 14:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541976629; cv=none; d=google.com; s=arc-20160816; b=b9Fn7tiLVazLXfmhYBvdBYNT0+O6qHO6VrJUyh0o2323OkPGkM1xJyfL1u4UtyIspj 0/jyxIXZV1TrYAvSZ7e10e4yABf+FDheecWT0xKfNMhfLhZF5gG5OKjeQGPJkgnhAB44 +yqEbLl+SQ0hidihXuVMipXtWYA8EgnDv/CdwrbgEVFiwZa4PUyVTtDVlNRtbHNWi3xU mRK0nESWi/dIRpy57Ajr/D9zHEZSEWdeWxoGcy1zv2Pj/4a7liahNdnONYdwyaJe7Cig azMaFN67ETYEaoA75wH7CpScjQAjppsOW4kEtVrmEjxu3ECER07XGcBjWNhUyJp3P7KS 77jQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rq3ICqhdPb+VpkW7Ypmt3xk9sS+FjrIBna71E4asHow=; b=RqI/DueUucI/4v6I0fAQ1K8+ncip8Q1yYaFB30LoK1P7oduTOUrkx23v8Vd/Z57R6j rE94zFQdI06xsFlmP2djXIJkXhEoTfNOrnLLk3onKJaZUXTs2I/wprn5WPNJnoXGktTC n8tUJQ7fQD29T3eDQF17YRB/v9BAozs6cFcCxk44/QV0rr20OTRviK8woY8ZOX2yY3d2 EPO9aHNrVGUmLKaIa3yMtFTmpJleePQ1e5Dvs703z6LKlb8FmfJJiHlwwqRCv1b11TOR 6QwJme9sgJBW1MdKk5oDLLM6sMQxi3d32rOi/71qj3OjjjZ00oHvB6EaNkiFiK0PPf2w 13zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Q76D63/J"; 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 p18si14582266pgb.469.2018.11.11.14.50.15; Sun, 11 Nov 2018 14:50:29 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="Q76D63/J"; 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 S2390965AbeKLIjz (ORCPT + 99 others); Mon, 12 Nov 2018 03:39:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:56360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404288AbeKLIXO (ORCPT ); Mon, 12 Nov 2018 03:23:14 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 75AB721780; Sun, 11 Nov 2018 22:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975596; bh=xBhNpwhsyq2sN3rokzc8aEtjK/9/bP+aCIbaOzF/Glg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q76D63/Jbidr7GcHulZSzlaExuw8RFyzsurjjLtK76hL2fiLBRD+eqDMPOMyTGZVt jXf7hc8JSP0UiqSoshM5FkDeXOTJlfmsoFLswnI/bD7ZYT1OfNiyvhz/9eTEPNyn6w MBoDSc/F/rQWpJwC9JRNAXklqindCEyqMteNpvQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.14 180/222] media: v4l2-tpg: fix kernel oops when enabling HFLIP and OSD Date: Sun, 11 Nov 2018 14:24:37 -0800 Message-Id: <20181111221703.141699213@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans Verkuil commit 250854eed5d45a73d81e4137dfd85180af6f2ec3 upstream. When the OSD is on (i.e. vivid displays text on top of the test pattern), and you enable hflip, then the driver crashes. The cause turned out to be a division of a negative number by an unsigned value. You expect that -8 / 2U would be -4, but in reality it is 2147483644 :-( Fixes: 3e14e7a82c1ef ("vivid-tpg: add hor/vert downsampling support to tpg_gen_text") Signed-off-by: Hans Verkuil Reported-by: Mauro Carvalho Chehab Cc: # for v4.1 and up Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c @@ -1765,7 +1765,7 @@ typedef struct { u16 __; u8 _; } __packe pos[7] = (chr & (0x01 << 0) ? fg : bg); \ } \ \ - pos += (tpg->hflip ? -8 : 8) / hdiv; \ + pos += (tpg->hflip ? -8 : 8) / (int)hdiv; \ } \ } \ } while (0)