Skip to content

Commit 359d16c

Browse files
committed
Merge branch 'for-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k fixes from Geert Uytterhoeven: "These are two critical fixes, needed by distro kernels, and thus also destined for stable: - The do_div() commit fixes a crash in mounting btrfs volumes, which was a regression from 3.2, - The ARAnyM fix allows to have NatFeat drivers as loadable modules, which is needed for initrds" * 'for-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: Truncate base in do_div() m68k/atari: ARAnyM - Fix NatFeat module support
2 parents 0f7dd1a + ea077b1 commit 359d16c

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

arch/m68k/emu/natfeat.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
#include <asm/machdep.h>
1919
#include <asm/natfeat.h>
2020

21+
extern long nf_get_id2(const char *feature_name);
22+
2123
asm("\n"
22-
" .global nf_get_id,nf_call\n"
23-
"nf_get_id:\n"
24+
" .global nf_get_id2,nf_call\n"
25+
"nf_get_id2:\n"
2426
" .short 0x7300\n"
2527
" rts\n"
2628
"nf_call:\n"
@@ -29,12 +31,25 @@ asm("\n"
2931
"1: moveq.l #0,%d0\n"
3032
" rts\n"
3133
" .section __ex_table,\"a\"\n"
32-
" .long nf_get_id,1b\n"
34+
" .long nf_get_id2,1b\n"
3335
" .long nf_call,1b\n"
3436
" .previous");
35-
EXPORT_SYMBOL_GPL(nf_get_id);
3637
EXPORT_SYMBOL_GPL(nf_call);
3738

39+
long nf_get_id(const char *feature_name)
40+
{
41+
/* feature_name may be in vmalloc()ed memory, so make a copy */
42+
char name_copy[32];
43+
size_t n;
44+
45+
n = strlcpy(name_copy, feature_name, sizeof(name_copy));
46+
if (n >= sizeof(name_copy))
47+
return 0;
48+
49+
return nf_get_id2(name_copy);
50+
}
51+
EXPORT_SYMBOL_GPL(nf_get_id);
52+
3853
void nfprint(const char *fmt, ...)
3954
{
4055
static char buf[256];

arch/m68k/include/asm/div64.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
unsigned long long n64; \
1616
} __n; \
1717
unsigned long __rem, __upper; \
18+
unsigned long __base = (base); \
1819
\
1920
__n.n64 = (n); \
2021
if ((__upper = __n.n32[0])) { \
2122
asm ("divul.l %2,%1:%0" \
22-
: "=d" (__n.n32[0]), "=d" (__upper) \
23-
: "d" (base), "0" (__n.n32[0])); \
23+
: "=d" (__n.n32[0]), "=d" (__upper) \
24+
: "d" (__base), "0" (__n.n32[0])); \
2425
} \
2526
asm ("divu.l %2,%1:%0" \
26-
: "=d" (__n.n32[1]), "=d" (__rem) \
27-
: "d" (base), "1" (__upper), "0" (__n.n32[1])); \
27+
: "=d" (__n.n32[1]), "=d" (__rem) \
28+
: "d" (__base), "1" (__upper), "0" (__n.n32[1])); \
2829
(n) = __n.n64; \
2930
__rem; \
3031
})

0 commit comments

Comments
 (0)