Skip to content

Commit 9b21993

Browse files
committed
Merge tag 'kgdb-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux
Pull kgdb updates from Daniel Thompson: "Three small changes this cycle: - Clean up an architecture abstraction that is no longer needed because all the architectures have converged. - Actually use the prompt argument to kdb_position_cursor() instead of ignoring it (functionally this fix is a nop but that was due to luck rather than good judgement) - Fix a -Wformat-security warning" * tag 'kgdb-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux: kdb: Get rid of redundant kdb_curr_task() kdb: Use the passed prompt in kdb_position_cursor() kdb: address -Wformat-security warnings
2 parents 28e7241 + 9bccbe7 commit 9b21993

File tree

4 files changed

+8
-20
lines changed

4 files changed

+8
-20
lines changed

kernel/debug/kdb/kdb_bt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ kdb_bt(int argc, const char **argv)
144144
kdb_ps_suppressed();
145145
/* Run the active tasks first */
146146
for_each_online_cpu(cpu) {
147-
p = kdb_curr_task(cpu);
147+
p = curr_task(cpu);
148148
if (kdb_bt1(p, mask, btaprompt))
149149
return 0;
150150
}

kernel/debug/kdb/kdb_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ char kdb_getchar(void)
206206
*/
207207
static void kdb_position_cursor(char *prompt, char *buffer, char *cp)
208208
{
209-
kdb_printf("\r%s", kdb_prompt_str);
209+
kdb_printf("\r%s", prompt);
210210
if (cp > buffer)
211211
kdb_printf("%.*s", (int)(cp - buffer), buffer);
212212
}
@@ -362,7 +362,7 @@ static char *kdb_read(char *buffer, size_t bufsize)
362362
if (i >= dtab_count)
363363
kdb_printf("...");
364364
kdb_printf("\n");
365-
kdb_printf(kdb_prompt_str);
365+
kdb_printf("%s", kdb_prompt_str);
366366
kdb_printf("%s", buffer);
367367
if (cp != lastchar)
368368
kdb_position_cursor(kdb_prompt_str, buffer, cp);
@@ -453,7 +453,7 @@ char *kdb_getstr(char *buffer, size_t bufsize, const char *prompt)
453453
{
454454
if (prompt && kdb_prompt_str != prompt)
455455
strscpy(kdb_prompt_str, prompt, CMD_BUFLEN);
456-
kdb_printf(kdb_prompt_str);
456+
kdb_printf("%s", kdb_prompt_str);
457457
kdb_nextline = 1; /* Prompt and input resets line number */
458458
return kdb_read(buffer, bufsize);
459459
}

kernel/debug/kdb/kdb_main.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,6 @@ static char *__env[31] = {
155155

156156
static const int __nenv = ARRAY_SIZE(__env);
157157

158-
struct task_struct *kdb_curr_task(int cpu)
159-
{
160-
struct task_struct *p = curr_task(cpu);
161-
#ifdef _TIF_MCA_INIT
162-
if ((task_thread_info(p)->flags & _TIF_MCA_INIT) && KDB_TSK(cpu))
163-
p = krp->p;
164-
#endif
165-
return p;
166-
}
167-
168158
/*
169159
* Update the permissions flags (kdb_cmd_enabled) to match the
170160
* current lockdown state.
@@ -1228,7 +1218,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
12281218
char *cmdbuf;
12291219
int diag;
12301220
struct task_struct *kdb_current =
1231-
kdb_curr_task(raw_smp_processor_id());
1221+
curr_task(raw_smp_processor_id());
12321222

12331223
KDB_DEBUG_STATE("kdb_local 1", reason);
12341224

@@ -2278,7 +2268,7 @@ void kdb_ps_suppressed(void)
22782268
unsigned long cpu;
22792269
const struct task_struct *p, *g;
22802270
for_each_online_cpu(cpu) {
2281-
p = kdb_curr_task(cpu);
2271+
p = curr_task(cpu);
22822272
if (kdb_task_state(p, "-"))
22832273
++idle;
22842274
}
@@ -2314,7 +2304,7 @@ void kdb_ps1(const struct task_struct *p)
23142304
kdb_task_has_cpu(p), kdb_process_cpu(p),
23152305
kdb_task_state_char(p),
23162306
(void *)(&p->thread),
2317-
p == kdb_curr_task(raw_smp_processor_id()) ? '*' : ' ',
2307+
p == curr_task(raw_smp_processor_id()) ? '*' : ' ',
23182308
p->comm);
23192309
if (kdb_task_has_cpu(p)) {
23202310
if (!KDB_TSK(cpu)) {
@@ -2350,7 +2340,7 @@ static int kdb_ps(int argc, const char **argv)
23502340
for_each_online_cpu(cpu) {
23512341
if (KDB_FLAG(CMD_INTERRUPT))
23522342
return 0;
2353-
p = kdb_curr_task(cpu);
2343+
p = curr_task(cpu);
23542344
if (kdb_task_state(p, mask))
23552345
kdb_ps1(p);
23562346
}

kernel/debug/kdb/kdb_private.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ extern void kdb_gdb_state_pass(char *buf);
210210
#define KDB_TSK(cpu) kgdb_info[cpu].task
211211
#define KDB_TSKREGS(cpu) kgdb_info[cpu].debuggerinfo
212212

213-
extern struct task_struct *kdb_curr_task(int);
214-
215213
#define kdb_task_has_cpu(p) (task_curr(p))
216214

217215
#define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL)

0 commit comments

Comments
 (0)