History log of /linux-master/arch/m68k/emu/natfeat.c
Revision Date Author Comments
# 6156086e 13-Sep-2023 Geert Uytterhoeven <geert@linux-m68k.org>

m68k: emu: Remove unused vsnprintf() return value in nfprint()

When building with W=1:

arch/m68k/emu/natfeat.c: In function ‘nfprint’:
arch/m68k/emu/natfeat.c:59:13: warning: variable ‘n’ set but not used [-Wunused-but-set-variable]
59 | int n;
| ^

As the return value of vsnprintf() is unused, and serves no practical
purpose here, fix this by removing the variable.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/a8b6b17ff352cc560d1848a92d171bb0f44ccb27.1694613528.git.geert@linux-m68k.org


# b149353d 30-Aug-2023 Azeem Shaikh <azeemshaikh38@gmail.com>

m68k: emu: Replace strlcpy() with strscpy()

strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since return value of -errno
is used to check for truncation instead of sizeof(dest).

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20230830185428.4109426-1-azeemshaikh38@gmail.com
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>


# f0f7e526 09-May-2022 Dmitry Osipenko <dmitry.osipenko@collabora.com>

m68k: Switch to new sys-off handler API

Kernel now supports chained power-off handlers. Use
register_power_off_handler() that registers power-off handlers and
do_kernel_power_off() that invokes chained power-off handlers. Legacy
pm_power_off() will be removed once all drivers will be converted to
the new sys-off API.

Normally arch code should adopt only the do_kernel_power_off() at first,
but m68k is a special case because it uses pm_power_off() "inside out",
i.e. pm_power_off() invokes machine_power_off() [in fact it does nothing],
while it's machine_power_off() that should invoke the pm_power_off(), and
thus, we can't convert platforms to the new API separately. There are only
two platforms changed here, so it's not a big deal.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# a4df02a2 25-Jun-2013 Geert Uytterhoeven <geert@linux-m68k.org>

m68k: Mark functions only called from setup_arch() __init

Some functions that are only called (indirectly) from setup_arch() lack
__init annotations.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>


# 55490050 14-Aug-2013 Geert Uytterhoeven <geert@linux-m68k.org>

m68k/atari: ARAnyM - Always use physical addresses in NatFeat calls

Pointers passed to ARAnyM NatFeat calls should be physical addresses,
not virtual addresses. This worked before because on Atari, physical and
virtual kernel addresses are the same, as long as normal kernel memory
is concerned.

Correct the few remaining places where virtual addresses were used.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>


# e8184e10 25-Jul-2013 Geert Uytterhoeven <geert@linux-m68k.org>

m68k/atari: ARAnyM - Fix NatFeat module support

As pointed out by Andreas Schwab, pointers passed to ARAnyM NatFeat calls
should be physical addresses, not virtual addresses.

Fortunately on Atari, physical and virtual kernel addresses are the same,
as long as normal kernel memory is concerned, so this usually worked fine
without conversion.

But for modules, pointers to literal strings are located in vmalloc()ed
memory. Depending on the version of ARAnyM, this causes the nf_get_id()
call to just fail, or worse, crash ARAnyM itself with e.g.

Gotcha! Illegal memory access. Atari PC = $968c

This is a big issue for distro kernels, who want to have all drivers as
loadable modules in an initrd.

Add a wrapper for nf_get_id() that copies the literal to the stack to
work around this issue.

Reported-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@vger.kernel.org


# 37b0b65f 18-Nov-2008 Roman Zippel <zippel@linux-m68k.org>

m68k/atari: ARAnyM - Add support for console access

[geert: Cleanups and updates]

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Petr Stehlik <pstehlik@sophics.cz>


# 65cd577d 18-Nov-2008 Petr Stehlik <pstehlik@sophics.cz>

m68k/atari: Initial ARAnyM support

Add improved support for running under the ARAnyM emulator
(Atari Running on Any Machine - http://aranym.org/).

[michael, geert: Cleanups and updates]

Signed-off-by: Petr Stehlik <pstehlik@sophics.cz>
Signed-off-by: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>