All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: linux-hardening@vger.kernel.org,
	Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>,
	llvm@lists.linux.dev
Subject: [bug report] clk: visconti: Add support common clock driver and reset driver
Date: Tue, 9 Dec 2025 16:05:58 +0300	[thread overview]
Message-ID: <aTgetqy8BGerPGTl@stanley.mountain> (raw)

Hello Kernel Hardenning developers,

Commit b4cbe606dc36 ("clk: visconti: Add support common clock driver
and reset driver") from Oct 25, 2021 (linux-next), leads to the
question:

drivers/clk/visconti/clkc.c
    187 struct visconti_clk_provider *visconti_init_clk(struct device *dev,
    188                                                 struct regmap *regmap,
    189                                                 unsigned long nr_clks)
    190 {
    191         struct visconti_clk_provider *ctx;
    192         int i;
    193 
    194         ctx = devm_kzalloc(dev, struct_size(ctx, clk_data.hws, nr_clks), GFP_KERNEL);
    195         if (!ctx)
    196                 return ERR_PTR(-ENOMEM);
    197 
    198         for (i = 0; i < nr_clks; ++i)
--> 199                 ctx->clk_data.hws[i] = ERR_PTR(-ENOENT);
    200         ctx->clk_data.num = nr_clks;

ctx->clk_data.hws[] is __counted_by() ctx->clk_data.num.  Don't we have to
set the .num before we fill initialize the array?  Or does the checker
code allow us to access the array when the counted by variable is zero?
I seem to remember this used to be a common false positive with the counted
by checking.

    201 
    202         ctx->dev = dev;
    203         ctx->regmap = regmap;
    204 
    205         return ctx;
    206 }

regards,
dan carpenter

             reply	other threads:[~2025-12-09 13:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 13:05 Dan Carpenter [this message]
2025-12-10  7:36 ` [bug report] clk: visconti: Add support common clock driver and reset driver Nathan Chancellor
2025-12-10  7:53   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2022-01-11  8:14 Dan Carpenter
2022-01-20 20:55 ` Stephen Boyd

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=aTgetqy8BGerPGTl@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nobuhiro.iwamatsu.x90@mail.toshiba \
    /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.