From patchwork Thu Nov 19 20:10:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michael_B=C3=BCsch?= X-Patchwork-Id: 7661431 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3348CBF90C for ; Thu, 19 Nov 2015 20:47:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 666AC20544 for ; Thu, 19 Nov 2015 20:47:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1E8220462 for ; Thu, 19 Nov 2015 20:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757113AbbKSUrG (ORCPT ); Thu, 19 Nov 2015 15:47:06 -0500 Received: from bues.ch ([80.190.117.144]:34682 "EHLO bues.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754642AbbKSUrF (ORCPT ); Thu, 19 Nov 2015 15:47:05 -0500 X-Greylist: delayed 1990 seconds by postgrey-1.27 at vger.kernel.org; Thu, 19 Nov 2015 15:47:05 EST Received: by bues.ch with esmtpsa (Exim 4.80) (envelope-from ) id 1ZzVaZ-0001dD-M5; Thu, 19 Nov 2015 21:13:51 +0100 Date: Thu, 19 Nov 2015 21:10:06 +0100 From: Michael =?UTF-8?B?QsO8c2No?= To: dri-devel@lists.freedesktop.org, David Airlie , Antonino Daplas , linux-fbdev@vger.kernel.org, linux-kernel , Andrew Morton Subject: [PATCH] nvidia/noveau: Fix color mask Message-ID: <20151119211006.75c1d924@wiggum> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The expression (~0 >> x) will always yield all-ones, because the right shift is an arithmetic right shift that will always shift ones in. Accordingly ~(~0 >> x) will always be zero. Hence 'mask' will always be zero in this case. Fix this by forcing a logical right shift instead of an arithmetic right shift by using an unsigned int constant. Signed-off-by: Michael Buesch --- This patch is untested, because I do not have the hardware. Resend: Patch was originally sent on Wed, 17 Jun 2015. Index: linux/drivers/gpu/drm/nouveau/nv50_fbcon.c =================================================================== --- linux.orig/drivers/gpu/drm/nouveau/nv50_fbcon.c +++ linux/drivers/gpu/drm/nouveau/nv50_fbcon.c @@ -96,7 +96,7 @@ nv50_fbcon_imageblit(struct fb_info *inf struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_channel *chan = drm->channel; uint32_t width, dwords, *data = (uint32_t *)image->data; - uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel)); + uint32_t mask = ~(~0U >> (32 - info->var.bits_per_pixel)); uint32_t *palette = info->pseudo_palette; int ret; Index: linux/drivers/gpu/drm/nouveau/nvc0_fbcon.c =================================================================== --- linux.orig/drivers/gpu/drm/nouveau/nvc0_fbcon.c +++ linux/drivers/gpu/drm/nouveau/nvc0_fbcon.c @@ -96,7 +96,7 @@ nvc0_fbcon_imageblit(struct fb_info *inf struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_channel *chan = drm->channel; uint32_t width, dwords, *data = (uint32_t *)image->data; - uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel)); + uint32_t mask = ~(~0U >> (32 - info->var.bits_per_pixel)); uint32_t *palette = info->pseudo_palette; int ret; Index: linux/drivers/video/fbdev/nvidia/nv_accel.c =================================================================== --- linux.orig/drivers/video/fbdev/nvidia/nv_accel.c +++ linux/drivers/video/fbdev/nvidia/nv_accel.c @@ -351,7 +351,7 @@ static void nvidiafb_mono_color_expand(s const struct fb_image *image) { struct nvidia_par *par = info->par; - u32 fg, bg, mask = ~(~0 >> (32 - info->var.bits_per_pixel)); + u32 fg, bg, mask = ~(~0U >> (32 - info->var.bits_per_pixel)); u32 dsize, width, *data = (u32 *) image->data, tmp; int j, k = 0;