All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans Verkuil <hverkuil@kernel.org>,
	Nas Chung <nas.chung@chipsnmedia.com>,
	Jackson Lee <jackson.lee@chipsnmedia.com>,
	Bingbu Cao <bingbu.cao@intel.com>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Keke Li <keke.li@amlogic.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH 0/6] media: Fix new smatch warnings
Date: Wed, 29 Apr 2026 13:31:04 +0300	[thread overview]
Message-ID: <afHd6LT7rCPlqDQE@stanley.mountain> (raw)
In-Reply-To: <CANiDSCvn3EbrPUiGYzE1zDHp=kKPJLAgHx17OJvv7gWLZM9tBw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

On Tue, Apr 28, 2026 at 03:58:08PM +0200, Ricardo Ribalda wrote:
> 
> The only one that deserves a complain is this one:
> https://lore.kernel.org/linux-media/CANiDSCtm4Nh4Ub4rbEBvpjV8GXT9VQ5eFXZTHn=Wy=0RpR=3JA@mail.gmail.com/T/#m650723c33ec0318d8f32f1a6cc74c74a952ae11a

Thanks.  I've written a fix for this.  Let me test it tonight
and I'll push later.

I've attached the validation/ test so you can look at the new
ouput. ./smatch sm_mask1.c

regards,
dan carpenter

[-- Attachment #2: sm_mask1.c --]
[-- Type: text/x-csrc, Size: 1183 bytes --]

#include "check_debug.h"

void func(int a, int b, int c, int d, int e)
{
	if (a < 65)
		return;
	if (b < 0 || b > 7)
		return;
	if (c < 7 || c > 17)
		return;
	if (d < 0)
		return;

	e &= 0xf0;

	__smatch_implied(a);
	__smatch_implied(a & ~7);
	__smatch_implied(~7 & a);
	__smatch_implied(b & ~7);
	__smatch_implied(c & ~7);
	__smatch_implied(d & 0xff);
	__smatch_implied(d & 0xf0);
	__smatch_implied(d & e);
	__smatch_implied(d & (unsigned char)a);
	__smatch_implied(b & (unsigned char)a);
	__smatch_implied(c & (unsigned char)a);
}

/*
 * check-name: smatch: mask #1
 * check-command: ./smatch -I.. sm_mask1.c
 *
 * check-output-start
sm_mask1.c:16 func() implied: a = '65-s32max'
sm_mask1.c:17 func() implied: a & ~7 = '64-s32max'
sm_mask1.c:18 func() implied: ~7 & a = '64-s32max'
sm_mask1.c:19 func() implied: b & ~7 = '0'
sm_mask1.c:20 func() implied: c & ~7 = '0,8-16'
sm_mask1.c:21 func() implied: d & 255 = '0-255'
sm_mask1.c:22 func() implied: d & 240 = '0,16-240'
sm_mask1.c:23 func() implied: d & e = '0,16-240'
sm_mask1.c:24 func() implied: d & a = '0-255'
sm_mask1.c:25 func() implied: b & a = '0-7'
sm_mask1.c:26 func() implied: c & a = '0-17'
 * check-output-end
 */

      parent reply	other threads:[~2026-04-29 10:31 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 12:41 [PATCH 0/6] media: Fix new smatch warnings Ricardo Ribalda
2026-04-28 12:41 ` [PATCH 1/6] media: v4l2-dev: Add range check for vdev->minor Ricardo Ribalda
2026-04-29  7:38   ` Hans Verkuil
2026-04-29  7:43   ` Sakari Ailus
2026-04-29  7:53     ` Hans Verkuil
2026-04-29  8:52       ` Sakari Ailus
2026-04-28 12:41 ` [PATCH 2/6] media: i2c: mt9p031: Rewrite a bitwise mask Ricardo Ribalda
2026-04-28 13:25   ` Laurent Pinchart
2026-04-28 13:37     ` Ricardo Ribalda
2026-04-28 12:41 ` [PATCH 3/6] media: i2c: adv7604: Add range checks for chip info Ricardo Ribalda
2026-04-29  7:40   ` Hans Verkuil
2026-04-28 12:41 ` [PATCH 4/6] media: chips-media: wave5: Add range checks for dec_output_info Ricardo Ribalda
2026-04-28 12:41 ` [PATCH 5/6] media: staging: ipu3-imgu: Add range check for imgu_css_cfg_acc_stripe Ricardo Ribalda
2026-04-28 13:13   ` Laurent Pinchart
2026-04-28 13:17     ` Ricardo Ribalda
2026-04-28 12:41 ` [PATCH 6/6] media: amlogic-c3: Add validations for ae and awb config Ricardo Ribalda
2026-04-28 13:10   ` Laurent Pinchart
2026-04-28 13:14     ` Ricardo Ribalda
2026-04-28 13:15       ` Ricardo Ribalda
2026-04-28 13:26       ` Laurent Pinchart
2026-04-28 13:49         ` Ricardo Ribalda
2026-04-29  6:15           ` Jacopo Mondi
2026-04-29  6:44             ` Ricardo Ribalda
2026-04-29  6:55               ` Jacopo Mondi
2026-04-29  7:15                 ` Ricardo Ribalda
2026-04-29  7:30                   ` Jacopo Mondi
2026-04-28 13:52 ` [PATCH 0/6] media: Fix new smatch warnings Dan Carpenter
2026-04-28 13:58   ` Ricardo Ribalda
2026-04-29  7:23     ` Laurent Pinchart
2026-04-29 10:31     ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afHd6LT7rCPlqDQE@stanley.mountain \
    --to=error27@gmail.com \
    --cc=bingbu.cao@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@kernel.org \
    --cc=jackson.lee@chipsnmedia.com \
    --cc=keke.li@amlogic.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nas.chung@chipsnmedia.com \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.