Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: [bug report] drm/xe/configfs: Allow to select by class only
Date: Tue, 23 Sep 2025 10:22:06 +0300	[thread overview]
Message-ID: <aNJKnrCQmL9xS9Gv@stanley.mountain> (raw)

Hello Lucas De Marchi,

Commit e2a9854d806e ("drm/xe/configfs: Allow to select by class
only") from Sep 16, 2025 (linux-next), leads to the following Smatch
static checker warning:

	drivers/gpu/drm/xe/xe_configfs.c:331 lookup_engine_info()
	error: we previously assumed 'mask' could be null (see line 327)

drivers/gpu/drm/xe/xe_configfs.c
    317 static const struct engine_info *lookup_engine_info(const char *pattern, u64 *mask)
    318 {
    319         for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) {
    320                 u8 instance;
    321                 u16 bit;
    322 
    323                 if (!str_has_prefix(pattern, engine_info[i].cls))
    324                         continue;
    325 
    326                 pattern += strlen(engine_info[i].cls);
    327                 if (!mask && !*pattern)
                                  ^^
Presumably this should be || instead of &&.  If mask is NULL the
function can't succeed.

    328                         return &engine_info[i];
    329 
    330                 if (!strcmp(pattern, "*")) {
--> 331                         *mask = engine_info[i].mask;
    332                         return &engine_info[i];
    333                 }
    334 
    335                 if (kstrtou8(pattern, 10, &instance))
    336                         return NULL;
    337 
    338                 bit = __ffs64(engine_info[i].mask) + instance;
    339                 if (bit >= fls64(engine_info[i].mask))
    340                         return NULL;
    341 
    342                 *mask = BIT_ULL(bit);
    343                 return &engine_info[i];
    344         }
    345 
    346         return NULL;
    347 }

regards,
dan carpenter

             reply	other threads:[~2025-09-23  7:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23  7:22 Dan Carpenter [this message]
2025-09-23 15:21 ` [bug report] drm/xe/configfs: Allow to select by class only Lucas De Marchi

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=aNJKnrCQmL9xS9Gv@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox