netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Tuo <islituo@gmail.com>
To: 3chas3@gmail.com
Cc: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [BUG] atm: firestream: possible uninitialized-variable access in fs_open()
Date: Sat, 31 Jul 2021 14:24:48 +0800	[thread overview]
Message-ID: <c83abdb6-440e-3fff-b7d8-f70d89343be9@gmail.com> (raw)

Hello,

Our static analysis tool finds a possible uninitialized-variable access 
in the firestream driver in Linux 5.14.0-rc3:

In the function fs_open(), a memory block is allocated through 
kmalloc(), and its return value is assigned to the pointer vcc.
883:    vcc = kmalloc(sizeof(struct fs_vcc), GFP_KERNEL);

If the following condition is false, vcc->channo will remain uninitialized.
898:    if (!test_bit(ATM_VF_PARTIAL, &atm_vcc->flags))

However, it is accessed in some statements such as:
1036:    submit_command (... , QE_CMD_CONFIG_TX | QE_CMD_IMM_INQ | 
vcc->channo, ...);
1040:    submit_command (... , QE_CMD_TX_EN | QE_CMD_IMM_INQ | 
vcc->channo, ...);
1043:    set_bit (vcc->channo, dev->tx_inuse);
1047:    dev->atm_vccs[vcc->channo] = atm_vcc;
1057:    dev->atm_vccs[vcc->channo] = NULL;
1065:    submit_command (... , QE_CMD_CONFIG_RX | QE_CMD_IMM_INQ | 
vcc->channo, ...);
1072:    submit_command (... , QE_CMD_CONFIG_RX | QE_CMD_IMM_INQ | 
vcc->channo, ...);
1085:    submit_command (... , QE_CMD_RX_EN | QE_CMD_IMM_INQ | 
vcc->channo, ...);

I am not quite sure whether this possible uninitialized-variable access 
is real and how to fix it if it is real.
Any feedback would be appreciated, thanks!

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>

Best wishes,
Tuo Li

                 reply	other threads:[~2021-07-31  6:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=c83abdb6-440e-3fff-b7d8-f70d89343be9@gmail.com \
    --to=islituo@gmail.com \
    --cc=3chas3@gmail.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).