From: Dan Carpenter <dan.carpenter@oracle.com>
To: ralf@linux-mips.org
Cc: linux-mips@vger.kernel.org
Subject: [bug report] [MIPS] MT: Improved multithreading support.
Date: Wed, 14 Aug 2019 16:29:24 +0300 [thread overview]
Message-ID: <20190814132924.GA23964@mwanda> (raw)
[ This is ancient code, but the bug is straight forward -- dan ]
Hello Ralf Baechle,
The patch 41c594ab65fc: "[MIPS] MT: Improved multithreading support."
from Apr 5, 2006, leads to the following static checker warning:
arch/mips/kernel/smp-mt.c:168 vsmp_boot_secondary()
warn: potential pointer math issue
arch/mips/kernel/smp-mt.c
142 static int vsmp_boot_secondary(int cpu, struct task_struct *idle)
143 {
144 struct thread_info *gp = task_thread_info(idle);
^^^^^^^^^^^^^^^^^^^^^^
gp is a thread_info struct pointer.
145 dvpe();
146 set_c0_mvpcontrol(MVPCONTROL_VPC);
147
148 settc(cpu);
149
150 /* restart */
151 write_tc_c0_tcrestart((unsigned long)&smp_bootstrap);
152
153 /* enable the tc this vpe/cpu will be running */
154 write_tc_c0_tcstatus((read_tc_c0_tcstatus() & ~TCSTATUS_IXMT) | TCSTATUS_A);
155
156 write_tc_c0_tchalt(0);
157
158 /* enable the VPE */
159 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA);
160
161 /* stack pointer */
162 write_tc_gpr_sp( __KSTK_TOS(idle));
163
164 /* global pointer */
165 write_tc_gpr_gp((unsigned long)gp);
166
167 flush_icache_range((unsigned long)gp,
168 (unsigned long)(gp + sizeof(struct thread_info)));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This should almost certainly be "gp + 1" because of pointer math.
169
170 /* finally out of configuration and into chaos */
171 clear_c0_mvpcontrol(MVPCONTROL_VPC);
172
173 evpe(EVPE_ENABLE);
174
175 return 0;
176 }
regards,
dan carpenter
reply other threads:[~2019-08-14 13:29 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=20190814132924.GA23964@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-mips@vger.kernel.org \
--cc=ralf@linux-mips.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 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.