@@ -48,7 +48,7 @@ ftrace_call_replace(unsigned long ip, unsigned long addr, int link)
48
48
addr = ppc_function_entry ((void * )addr );
49
49
50
50
/* if (link) set op to 'bl' else 'b' */
51
- op = create_branch ((unsigned int * )ip , addr , link ? 1 : 0 );
51
+ create_branch (& op , (unsigned int * )ip , addr , link ? 1 : 0 );
52
52
53
53
return op ;
54
54
}
@@ -89,10 +89,11 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new)
89
89
*/
90
90
static int test_24bit_addr (unsigned long ip , unsigned long addr )
91
91
{
92
+ unsigned int op ;
92
93
addr = ppc_function_entry ((void * )addr );
93
94
94
95
/* use the create_branch to verify that this offset can be branched */
95
- return create_branch ((unsigned int * )ip , addr , 0 );
96
+ return create_branch (& op , (unsigned int * )ip , addr , 0 ) == 0 ;
96
97
}
97
98
98
99
static int is_bl_op (unsigned int op )
@@ -287,6 +288,7 @@ __ftrace_make_nop(struct module *mod,
287
288
static unsigned long find_ftrace_tramp (unsigned long ip )
288
289
{
289
290
int i ;
291
+ unsigned int instr ;
290
292
291
293
/*
292
294
* We have the compiler generated long_branch tramps at the end
@@ -295,7 +297,8 @@ static unsigned long find_ftrace_tramp(unsigned long ip)
295
297
for (i = NUM_FTRACE_TRAMPS - 1 ; i >= 0 ; i -- )
296
298
if (!ftrace_tramps [i ])
297
299
continue ;
298
- else if (create_branch ((void * )ip , ftrace_tramps [i ], 0 ))
300
+ else if (create_branch (& instr , (void * )ip ,
301
+ ftrace_tramps [i ], 0 ) == 0 )
299
302
return ftrace_tramps [i ];
300
303
301
304
return 0 ;
@@ -324,6 +327,7 @@ static int setup_mcount_compiler_tramp(unsigned long tramp)
324
327
{
325
328
int i , op ;
326
329
unsigned long ptr ;
330
+ unsigned int instr ;
327
331
static unsigned long ftrace_plt_tramps [NUM_FTRACE_TRAMPS ];
328
332
329
333
/* Is this a known long jump tramp? */
@@ -366,7 +370,7 @@ static int setup_mcount_compiler_tramp(unsigned long tramp)
366
370
#else
367
371
ptr = ppc_global_function_entry ((void * )ftrace_caller );
368
372
#endif
369
- if (! create_branch ((void * )tramp , ptr , 0 )) {
373
+ if (create_branch (& instr , (void * )tramp , ptr , 0 )) {
370
374
pr_debug ("%ps is not reachable from existing mcount tramp\n" ,
371
375
(void * )ptr );
372
376
return -1 ;
@@ -511,6 +515,7 @@ static int
511
515
__ftrace_make_call (struct dyn_ftrace * rec , unsigned long addr )
512
516
{
513
517
unsigned int op [2 ];
518
+ unsigned int instr ;
514
519
void * ip = (void * )rec -> ip ;
515
520
unsigned long entry , ptr , tramp ;
516
521
struct module * mod = rec -> arch .mod ;
@@ -557,7 +562,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
557
562
}
558
563
559
564
/* Ensure branch is within 24 bits */
560
- if (! create_branch (ip , tramp , BRANCH_SET_LINK )) {
565
+ if (create_branch (& instr , ip , tramp , BRANCH_SET_LINK )) {
561
566
pr_err ("Branch out of range\n" );
562
567
return - EINVAL ;
563
568
}
@@ -574,6 +579,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
574
579
static int
575
580
__ftrace_make_call (struct dyn_ftrace * rec , unsigned long addr )
576
581
{
582
+ int err ;
577
583
unsigned int op ;
578
584
unsigned long ip = rec -> ip ;
579
585
@@ -594,9 +600,9 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
594
600
}
595
601
596
602
/* create the branch to the trampoline */
597
- op = create_branch ((unsigned int * )ip ,
598
- rec -> arch .mod -> arch .tramp , BRANCH_SET_LINK );
599
- if (! op ) {
603
+ err = create_branch (& op , (unsigned int * )ip ,
604
+ rec -> arch .mod -> arch .tramp , BRANCH_SET_LINK );
605
+ if (err ) {
600
606
pr_err ("REL24 out of range!\n" );
601
607
return - EINVAL ;
602
608
}
@@ -776,7 +782,7 @@ __ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
776
782
}
777
783
778
784
/* Ensure branch is within 24 bits */
779
- if (! create_branch ((unsigned int * )ip , tramp , BRANCH_SET_LINK )) {
785
+ if (create_branch (& op , (unsigned int * )ip , tramp , BRANCH_SET_LINK )) {
780
786
pr_err ("Branch out of range\n" );
781
787
return - EINVAL ;
782
788
}
0 commit comments