Since defanging in v2.6.12-rc1 it's set exactly once per port on probe
and checked exactly once per port on unload: it's useless. Kill it.
Notably, magic-number.rst has never had the right value for it with the
new-in-2.1.105 network-based driver
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Ref: https://lore.kernel.org/linux-doc/[email protected]/
---
Documentation/process/magic-number.rst | 1 -
.../translations/it_IT/process/magic-number.rst | 1 -
.../translations/zh_CN/process/magic-number.rst | 1 -
.../translations/zh_TW/process/magic-number.rst | 1 -
drivers/net/hamradio/baycom_epp.c | 15 ++-------------
5 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 64b5948fc1d4..87353e0207c1 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -73,7 +73,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 02eb7eb2448e..a96712bd8a68 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -79,7 +79,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 0617ce125e12..44f3a29fce57 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -62,7 +62,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index f3f7082e17c6..0fde3183e82a 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -65,7 +65,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 791b4a53d69f..8f018703e74d 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -45,13 +45,9 @@
/* --------------------------------------------------------------------- */
#define BAYCOM_DEBUG
-#define BAYCOM_MAGIC 19730510
/* --------------------------------------------------------------------- */
-static const char paranoia_str[] = KERN_ERR
- "baycom_epp: bad magic number for hdlcdrv_state struct in routine %s\n";
-
static const char bc_drvname[] = "baycom_epp";
static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n"
"baycom_epp: version 0.7\n";
@@ -152,8 +148,6 @@ static struct net_device *baycom_device[NR_PORTS];
*/
struct baycom_state {
- int magic;
-
struct pardevice *pdev;
struct net_device *dev;
unsigned int work_running;
@@ -1210,7 +1204,6 @@ static void __init baycom_epp_dev_setup(struct net_device *dev)
* initialize part of the baycom_state struct
*/
bc->dev = dev;
- bc->magic = BAYCOM_MAGIC;
bc->cfg.fclk = 19666600;
bc->cfg.bps = 9600;
/*
@@ -1279,12 +1272,8 @@ static void __exit cleanup_baycomepp(void)
struct net_device *dev = baycom_device[i];
if (dev) {
- struct baycom_state *bc = netdev_priv(dev);
- if (bc->magic == BAYCOM_MAGIC) {
- unregister_netdev(dev);
- free_netdev(dev);
- } else
- printk(paranoia_str, "cleanup_module");
+ unregister_netdev(dev);
+ free_netdev(dev);
}
}
parport_unregister_driver(&baycom_epp_par_driver);
--
2.30.2
MGSLPC_PARANOIA_CHECK has never been defined automatically,
and devices with null driver_info can't happen, since we reject the open
in that case
Move the log statement from dead code to the check,
and log the state inconsistency like we do above for the line count
("invalid line #%d.")
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
drivers/char/pcmcia/synclink_cs.c | 71 +++----------------------------
1 file changed, 6 insertions(+), 65 deletions(-)
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 262f087bfc01..19b6118639b4 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -644,25 +644,6 @@ static int mgslpc_resume(struct pcmcia_device *link)
}
-static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info,
- char *name, const char *routine)
-{
-#ifdef MGSLPC_PARANOIA_CHECK
- static const char *badinfo =
- "Warning: null mgslpc_info for (%s) in %s\n";
-
- if (!info) {
- printk(badinfo, name, routine);
- return true;
- }
-#else
- if (!info)
- return true;
-#endif
- return false;
-}
-
-
#define CMD_RXFIFO BIT7 // release current rx FIFO
#define CMD_RXRESET BIT6 // receiver reset
#define CMD_RXFIFO_READ BIT5
@@ -694,8 +675,6 @@ static void tx_pause(struct tty_struct *tty)
MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
unsigned long flags;
- if (mgslpc_paranoia_check(info, tty->name, "tx_pause"))
- return;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("tx_pause(%s)\n", info->device_name);
@@ -710,8 +689,6 @@ static void tx_release(struct tty_struct *tty)
MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
unsigned long flags;
- if (mgslpc_paranoia_check(info, tty->name, "tx_release"))
- return;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("tx_release(%s)\n", info->device_name);
@@ -1476,9 +1453,6 @@ static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch)
__FILE__, __LINE__, ch, info->device_name);
}
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char"))
- return 0;
-
if (!info->tx_buf)
return 0;
@@ -1508,9 +1482,6 @@ static void mgslpc_flush_chars(struct tty_struct *tty)
printk("%s(%d):mgslpc_flush_chars() entry on %s tx_count=%d\n",
__FILE__, __LINE__, info->device_name, info->tx_count);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars"))
- return;
-
if (info->tx_count <= 0 || tty->flow.stopped ||
tty->hw_stopped || !info->tx_buf)
return;
@@ -1546,8 +1517,7 @@ static int mgslpc_write(struct tty_struct * tty,
printk("%s(%d):mgslpc_write(%s) count=%d\n",
__FILE__, __LINE__, info->device_name, count);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") ||
- !info->tx_buf)
+ if (!info->tx_buf)
goto cleanup;
if (info->params.mode == MGSL_MODE_HDLC) {
@@ -1600,9 +1570,6 @@ static unsigned int mgslpc_write_room(struct tty_struct *tty)
MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
int ret;
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write_room"))
- return 0;
-
if (info->params.mode == MGSL_MODE_HDLC) {
/* HDLC (frame oriented) mode */
if (info->tx_active)
@@ -1632,9 +1599,6 @@ static unsigned int mgslpc_chars_in_buffer(struct tty_struct *tty)
printk("%s(%d):mgslpc_chars_in_buffer(%s)\n",
__FILE__, __LINE__, info->device_name);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer"))
- return 0;
-
if (info->params.mode == MGSL_MODE_HDLC)
rc = info->tx_active ? info->max_frame_size : 0;
else
@@ -1658,9 +1622,6 @@ static void mgslpc_flush_buffer(struct tty_struct *tty)
printk("%s(%d):mgslpc_flush_buffer(%s) entry\n",
__FILE__, __LINE__, info->device_name);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer"))
- return;
-
spin_lock_irqsave(&info->lock, flags);
info->tx_count = info->tx_put = info->tx_get = 0;
del_timer(&info->tx_timer);
@@ -1681,9 +1642,6 @@ static void mgslpc_send_xchar(struct tty_struct *tty, char ch)
printk("%s(%d):mgslpc_send_xchar(%s,%d)\n",
__FILE__, __LINE__, info->device_name, ch);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar"))
- return;
-
info->x_char = ch;
if (ch) {
spin_lock_irqsave(&info->lock, flags);
@@ -1704,9 +1662,6 @@ static void mgslpc_throttle(struct tty_struct * tty)
printk("%s(%d):mgslpc_throttle(%s) entry\n",
__FILE__, __LINE__, info->device_name);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle"))
- return;
-
if (I_IXOFF(tty))
mgslpc_send_xchar(tty, STOP_CHAR(tty));
@@ -1729,9 +1684,6 @@ static void mgslpc_unthrottle(struct tty_struct * tty)
printk("%s(%d):mgslpc_unthrottle(%s) entry\n",
__FILE__, __LINE__, info->device_name);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle"))
- return;
-
if (I_IXOFF(tty)) {
if (info->x_char)
info->x_char = 0;
@@ -2160,9 +2112,6 @@ static int mgslpc_break(struct tty_struct *tty, int break_state)
printk("%s(%d):mgslpc_break(%s,%d)\n",
__FILE__, __LINE__, info->device_name, break_state);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break"))
- return -EINVAL;
-
spin_lock_irqsave(&info->lock, flags);
if (break_state == -1)
set_reg_bits(info, CHA+DAFO, BIT6);
@@ -2218,9 +2167,6 @@ static int mgslpc_ioctl(struct tty_struct *tty,
printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__, __LINE__,
info->device_name, cmd);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl"))
- return -ENODEV;
-
if (cmd != TIOCMIWAIT) {
if (tty_io_error(tty))
return -EIO;
@@ -2312,9 +2258,6 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
struct tty_port *port = &info->port;
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_close"))
- return;
-
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):mgslpc_close(%s) entry, count=%d\n",
__FILE__, __LINE__, info->device_name, port->count);
@@ -2352,9 +2295,6 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout)
printk("%s(%d):mgslpc_wait_until_sent(%s) entry\n",
__FILE__, __LINE__, info->device_name);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent"))
- return;
-
if (!tty_port_initialized(&info->port))
goto exit;
@@ -2412,9 +2352,6 @@ static void mgslpc_hangup(struct tty_struct *tty)
printk("%s(%d):mgslpc_hangup(%s)\n",
__FILE__, __LINE__, info->device_name);
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup"))
- return;
-
mgslpc_flush_buffer(tty);
shutdown(info, tty);
tty_port_hangup(&info->port);
@@ -2468,8 +2405,12 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
info = mgslpc_device_list;
while(info && info->line != line)
info = info->next_device;
- if (mgslpc_paranoia_check(info, tty->name, "mgslpc_open"))
+ if (!info) {
+ printk(KERN_WARNING "%s(%d):mgslpc_open: "
+ "no device for line #%d.\n",
+ __FILE__, __LINE__, line);
return -ENODEV;
+ }
port = &info->port;
tty->driver_data = info;
--
2.30.2
The only user is arch/mips/sgi-ip27/ip27-nmi.c;
this file was imported wholesale in 2.3.99pre9-1,
and received only whitespace updates since then
NMI_MAGIC isn't a magic number; it's unclear if it's actually used
by the firmware in some capacity or if it's a holdover from copying
the SGI code, but in the former case it's API
and in the latter it's dead cruft
Lack of QEMU support makes this unvalidatable without the hardware,
so leave it in
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
.../it_IT/process/magic-number.rst | 1 -
.../zh_CN/process/magic-number.rst | 1 -
.../zh_TW/process/magic-number.rst | 1 -
arch/mips/include/asm/sn/nmi.h | 60 -------------------
5 files changed, 64 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 62a3a2113e7c..7dada7abc733 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -76,5 +76,4 @@ KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/incl
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
-NMI_MAGIC 0x48414d4d455201 nmi_s ``arch/mips/include/asm/sn/nmi.h``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index b20a54ee6fb2..f9634a04d349 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -82,5 +82,4 @@ KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/incl
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
-NMI_MAGIC 0x48414d4d455201 nmi_s ``arch/mips/include/asm/sn/nmi.h``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index e7781ab923f7..966b9e6b1a46 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -65,5 +65,4 @@ KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/incl
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
-NMI_MAGIC 0x48414d4d455201 nmi_s ``arch/mips/include/asm/sn/nmi.h``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 5cc0bfa97d9d..f3e87a6b3a01 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -68,5 +68,4 @@ KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/incl
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
-NMI_MAGIC 0x48414d4d455201 nmi_s ``arch/mips/include/asm/sn/nmi.h``
===================== ================ ======================== ==========================================
diff --git a/arch/mips/include/asm/sn/nmi.h b/arch/mips/include/asm/sn/nmi.h
index 12ac210f12a1..0bd9458fc804 100644
--- a/arch/mips/include/asm/sn/nmi.h
+++ b/arch/mips/include/asm/sn/nmi.h
@@ -10,8 +10,6 @@
#ifndef __ASM_SN_NMI_H
#define __ASM_SN_NMI_H
-#include <asm/sn/addrs.h>
-
/*
* The launch data structure resides at a fixed place in each node's memory
* and is used to communicate between the master processor and the slave
@@ -29,14 +27,6 @@
*/
#define NMI_MAGIC 0x48414d4d455201
-#define NMI_SIZEOF 0x40
-
-#define NMI_OFF_MAGIC 0x00 /* Struct offsets for assembly */
-#define NMI_OFF_FLAGS 0x08
-#define NMI_OFF_CALL 0x10
-#define NMI_OFF_CALLC 0x18
-#define NMI_OFF_CALLPARM 0x20
-#define NMI_OFF_GMASTER 0x28
/*
* The NMI routine is called only if the complement address is
@@ -48,8 +38,6 @@
*
*/
-#ifndef __ASSEMBLY__
-
typedef struct nmi_s {
volatile unsigned long magic; /* Magic number */
volatile unsigned long flags; /* Combination of flags above */
@@ -59,14 +47,10 @@ typedef struct nmi_s {
volatile unsigned long gmaster; /* Flag true only on global master*/
} nmi_t;
-#endif /* !__ASSEMBLY__ */
-
/* Following definitions are needed both in the prom & the kernel
* to identify the format of the nmi cpu register save area in the
* low memory on each node.
*/
-#ifndef __ASSEMBLY__
-
struct reg_struct {
unsigned long gpr[32];
unsigned long sr;
@@ -78,48 +62,4 @@ struct reg_struct {
unsigned long nmi_sr;
};
-#endif /* !__ASSEMBLY__ */
-
-/* These are the assembly language offsets into the reg_struct structure */
-
-#define R0_OFF 0x0
-#define R1_OFF 0x8
-#define R2_OFF 0x10
-#define R3_OFF 0x18
-#define R4_OFF 0x20
-#define R5_OFF 0x28
-#define R6_OFF 0x30
-#define R7_OFF 0x38
-#define R8_OFF 0x40
-#define R9_OFF 0x48
-#define R10_OFF 0x50
-#define R11_OFF 0x58
-#define R12_OFF 0x60
-#define R13_OFF 0x68
-#define R14_OFF 0x70
-#define R15_OFF 0x78
-#define R16_OFF 0x80
-#define R17_OFF 0x88
-#define R18_OFF 0x90
-#define R19_OFF 0x98
-#define R20_OFF 0xa0
-#define R21_OFF 0xa8
-#define R22_OFF 0xb0
-#define R23_OFF 0xb8
-#define R24_OFF 0xc0
-#define R25_OFF 0xc8
-#define R26_OFF 0xd0
-#define R27_OFF 0xd8
-#define R28_OFF 0xe0
-#define R29_OFF 0xe8
-#define R30_OFF 0xf0
-#define R31_OFF 0xf8
-#define SR_OFF 0x100
-#define CAUSE_OFF 0x108
-#define EPC_OFF 0x110
-#define BADVA_OFF 0x118
-#define ERROR_EPC_OFF 0x120
-#define CACHE_ERR_OFF 0x128
-#define NMISR_OFF 0x130
-
#endif /* __ASM_SN_NMI_H */
--
2.30.2
It appeared in the original import of SGI code in 2.4.0-test3pre8
and has never been used anywhere
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
Documentation/translations/zh_TW/process/magic-number.rst | 1 -
arch/mips/include/asm/sn/klkernvars.h | 8 ++------
arch/mips/sgi-ip27/ip27-klnuma.c | 1 -
6 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 7dada7abc733..d8ffbc21872e 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -72,7 +72,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
-KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index f9634a04d349..0e59704aa617 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -78,7 +78,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
-KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 966b9e6b1a46..17a73661ef17 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -61,7 +61,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
-KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index f3e87a6b3a01..9d44d49b93bf 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -64,7 +64,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
-KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/arch/mips/include/asm/sn/klkernvars.h b/arch/mips/include/asm/sn/klkernvars.h
index ea6b21795163..93d5eb873255 100644
--- a/arch/mips/include/asm/sn/klkernvars.h
+++ b/arch/mips/include/asm/sn/klkernvars.h
@@ -6,18 +6,14 @@
#ifndef __ASM_SN_KLKERNVARS_H
#define __ASM_SN_KLKERNVARS_H
-#define KV_MAGIC_OFFSET 0x0
-#define KV_RO_NASID_OFFSET 0x4
-#define KV_RW_NASID_OFFSET 0x6
-
-#define KV_MAGIC 0x5f4b565f
+#define KV_RO_NASID_OFFSET 0x0
+#define KV_RW_NASID_OFFSET 0x2
#ifndef __ASSEMBLY__
#include <asm/sn/types.h>
typedef struct kern_vars_s {
- int kv_magic;
nasid_t kv_ro_nasid;
nasid_t kv_rw_nasid;
unsigned long kv_ro_baseaddr;
diff --git a/arch/mips/sgi-ip27/ip27-klnuma.c b/arch/mips/sgi-ip27/ip27-klnuma.c
index abd7a84df7dd..82bb7ac20ef8 100644
--- a/arch/mips/sgi-ip27/ip27-klnuma.c
+++ b/arch/mips/sgi-ip27/ip27-klnuma.c
@@ -61,7 +61,6 @@ static __init void set_ktext_source(nasid_t client_nasid, nasid_t server_nasid)
KERN_VARS_ADDR(client_nasid) = (unsigned long)kvp;
- kvp->kv_magic = KV_MAGIC;
kvp->kv_ro_nasid = server_nasid;
kvp->kv_rw_nasid = master_nasid;
kvp->kv_ro_baseaddr = NODE_CAC_BASE(server_nasid);
--
2.30.2
We have largely moved away from this approach,
and we have better debugging instrumentation nowadays: kill it
Additionally, ~half HDLCDRV_MAGIC checks just early-exit instead
of noting the bug, so they're detrimental, if anything
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
.../translations/it_IT/process/magic-number.rst | 1 -
.../translations/zh_CN/process/magic-number.rst | 1 -
.../translations/zh_TW/process/magic-number.rst | 1 -
drivers/net/hamradio/baycom_par.c | 1 -
drivers/net/hamradio/baycom_ser_fdx.c | 3 +--
drivers/net/hamradio/baycom_ser_hdx.c | 3 +--
drivers/net/hamradio/hdlcdrv.c | 9 +++------
include/linux/hdlcdrv.h | 2 --
9 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index c1c68c713cbc..3b3e607e1cbc 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -70,6 +70,5 @@ Magic Name Number Structure File
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 5b609ca78a14..e8c659b6a743 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -76,6 +76,5 @@ Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index ab4d4e32b61f..2105af32187c 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -59,6 +59,5 @@ Linux 魔术数
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index a6131d978189..793a0ae9fb7c 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -62,6 +62,5 @@ Linux 魔術數
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
index fd7da5bb1fa5..e1cf3ed42df6 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -418,7 +418,6 @@ static int baycom_ioctl(struct net_device *dev, void __user *data,
return -EINVAL;
bc = netdev_priv(dev);
- BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC);
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 646f605e358f..65113cb6de8d 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -252,7 +252,7 @@ static irqreturn_t ser12_interrupt(int irq, void *dev_id)
unsigned char iir, msr;
unsigned int txcount = 0;
- if (!bc || bc->hdrv.magic != HDLCDRV_MAGIC)
+ if (!bc)
return IRQ_NONE;
/* fast way out for shared irq */
if ((iir = inb(IIR(dev->base_addr))) & 1)
@@ -507,7 +507,6 @@ static int baycom_ioctl(struct net_device *dev, void __user *data,
return -EINVAL;
bc = netdev_priv(dev);
- BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC);
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c
index 5d1ab4840753..df33e5cdb5c2 100644
--- a/drivers/net/hamradio/baycom_ser_hdx.c
+++ b/drivers/net/hamradio/baycom_ser_hdx.c
@@ -365,7 +365,7 @@ static irqreturn_t ser12_interrupt(int irq, void *dev_id)
struct baycom_state *bc = netdev_priv(dev);
unsigned char iir;
- if (!dev || !bc || bc->hdrv.magic != HDLCDRV_MAGIC)
+ if (!dev || !bc)
return IRQ_NONE;
/* fast way out */
if ((iir = inb(IIR(dev->base_addr))) & 1)
@@ -561,7 +561,6 @@ static int baycom_ioctl(struct net_device *dev, void __user *data,
return -EINVAL;
bc = netdev_priv(dev);
- BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC);
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 2263029d1a20..60abd6008cc7 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -158,7 +158,7 @@ void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s)
int i;
unsigned int mask1, mask2, mask3, mask4, mask5, mask6, word;
- if (!s || s->magic != HDLCDRV_MAGIC)
+ if (!s)
return;
if (test_and_set_bit(0, &s->hdlcrx.in_hdlc_rx))
return;
@@ -257,7 +257,7 @@ void hdlcdrv_transmitter(struct net_device *dev, struct hdlcdrv_state *s)
struct sk_buff *skb;
int pkt_len;
- if (!s || s->magic != HDLCDRV_MAGIC)
+ if (!s)
return;
if (test_and_set_bit(0, &s->hdlctx.in_hdlc_tx))
return;
@@ -364,7 +364,7 @@ static void start_tx(struct net_device *dev, struct hdlcdrv_state *s)
void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
{
- if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb)
+ if (!s || s->hdlctx.ptt || !s->skb)
return;
if (s->ch_params.fulldup) {
start_tx(dev, s);
@@ -701,7 +701,6 @@ struct net_device *hdlcdrv_register(const struct hdlcdrv_ops *ops,
* initialize part of the hdlcdrv_state struct
*/
s = netdev_priv(dev);
- s->magic = HDLCDRV_MAGIC;
s->ops = ops;
dev->base_addr = baseaddr;
dev->irq = irq;
@@ -723,8 +722,6 @@ void hdlcdrv_unregister(struct net_device *dev)
{
struct hdlcdrv_state *s = netdev_priv(dev);
- BUG_ON(s->magic != HDLCDRV_MAGIC);
-
if (s->opened && s->ops->close)
s->ops->close(dev);
unregister_netdev(dev);
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index 5d70c3f98f5b..809ad0f5c99c 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -13,7 +13,6 @@
#include <linux/spinlock.h>
#include <uapi/linux/hdlcdrv.h>
-#define HDLCDRV_MAGIC 0x5ac6e778
#define HDLCDRV_HDLCBUFFER 32 /* should be a power of 2 for speed reasons */
#define HDLCDRV_BITBUFFER 256 /* should be a power of 2 for speed reasons */
#undef HDLCDRV_LOOPBACK /* define for HDLC debugging purposes */
@@ -84,7 +83,6 @@ struct hdlcdrv_ops {
};
struct hdlcdrv_state {
- int magic;
int opened;
const struct hdlcdrv_ops *ops;
--
2.30.2
We have largely moved away from this approach,
and we have better debugging instrumentation nowadays: kill it
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
Documentation/translations/zh_TW/process/magic-number.rst | 1 -
fs/fcntl.c | 6 ------
include/linux/fs.h | 3 ---
6 files changed, 13 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index e59c707ec785..6e432917a5a8 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -68,6 +68,5 @@ Changelog::
===================== ================ ======================== ==========================================
Magic Name Number Structure File
===================== ================ ======================== ==========================================
-FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 37a539867b6f..7d4c117ac626 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -74,6 +74,5 @@ Registro dei cambiamenti::
===================== ================ ======================== ==========================================
Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
-FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 8a3a3e872c52..c17e3f20440a 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -57,6 +57,5 @@ Linux 魔术数
===================== ================ ======================== ==========================================
魔术数名 数字 结构 文件
===================== ================ ======================== ==========================================
-FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 7ace7834f7f9..e2eeb74e7192 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -60,6 +60,5 @@ Linux 魔術數
===================== ================ ======================== ==========================================
魔術數名 數字 結構 文件
===================== ================ ======================== ==========================================
-FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 146c9ab0cd4b..e366a3804108 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -924,7 +924,6 @@ struct fasync_struct *fasync_insert_entry(int fd, struct file *filp, struct fasy
}
rwlock_init(&new->fa_lock);
- new->magic = FASYNC_MAGIC;
new->fa_file = filp;
new->fa_fd = fd;
new->fa_next = *fapp;
@@ -988,11 +987,6 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
struct fown_struct *fown;
unsigned long flags;
- if (fa->magic != FASYNC_MAGIC) {
- printk(KERN_ERR "kill_fasync: bad magic number in "
- "fasync_struct!\n");
- return;
- }
read_lock_irqsave(&fa->fa_lock, flags);
if (fa->fa_file) {
fown = &fa->fa_file->f_owner;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e654435f1651..acfd5db5341a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1345,15 +1345,12 @@ static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
struct fasync_struct {
rwlock_t fa_lock;
- int magic;
int fa_fd;
struct fasync_struct *fa_next; /* singly linked list */
struct file *fa_file;
struct rcu_head fa_rcu;
};
-#define FASYNC_MAGIC 0x4601
-
/* SMP safe fasync helpers: */
extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *);
--
2.30.2
The only non-boolean check might as well be,
since it just early-exits instead of of noting the bug:
lower it to a boolean and make it less confusing
As for magic numbers, we have largely moved away from this approach,
and we have better debugging instrumentation nowadays: kill it
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
.../it_IT/process/magic-number.rst | 1 -
.../zh_CN/process/magic-number.rst | 1 -
.../zh_TW/process/magic-number.rst | 1 -
drivers/scsi/ncr53c8xx.c | 25 ++++++-------------
5 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 6e432917a5a8..5a8c2755ac9c 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -68,5 +68,4 @@ Changelog::
===================== ================ ======================== ==========================================
Magic Name Number Structure File
===================== ================ ======================== ==========================================
-CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 7d4c117ac626..2fbc1876534a 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -74,5 +74,4 @@ Registro dei cambiamenti::
===================== ================ ======================== ==========================================
Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
-CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index c17e3f20440a..f8ec4767bc4e 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -57,5 +57,4 @@ Linux 魔术数
===================== ================ ======================== ==========================================
魔术数名 数字 结构 文件
===================== ================ ======================== ==========================================
-CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index e2eeb74e7192..0ccc60bee3d6 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -60,5 +60,4 @@ Linux 魔術數
===================== ================ ======================== ==========================================
魔術數名 數字 結構 文件
===================== ================ ======================== ==========================================
-CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 4458449c960b..928417fca495 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -1095,15 +1095,6 @@ typedef u32 tagmap_t;
#define NS_WIDE (2)
#define NS_PPR (4)
-/*==========================================================
-**
-** Misc.
-**
-**==========================================================
-*/
-
-#define CCB_MAGIC (0xf2691ad2)
-
/*==========================================================
**
** Declaration of structs.
@@ -1567,7 +1558,7 @@ struct ccb {
struct ccb * link_ccb; /* Host adapter CCB chain */
struct list_head link_ccbq; /* Link to unit CCB queue */
u32 startp; /* Initial data pointer */
- u_long magic; /* Free / busy CCB flag */
+ bool busy;
};
#define CCB_PHYS(cp,lbl) (cp->p_ccb + offsetof(struct ccb, lbl))
@@ -4356,7 +4347,7 @@ static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)
*/
/* activate this job. */
- cp->magic = CCB_MAGIC;
+ cp->busy = true;
/*
** insert next CCBs into start queue.
@@ -4667,7 +4658,7 @@ void ncr_complete (struct ncb *np, struct ccb *cp)
** Sanity check
*/
- if (!cp || cp->magic != CCB_MAGIC || !cp->cmd)
+ if (!cp || !cp->busy || !cp->cmd)
return;
/*
@@ -6998,7 +6989,7 @@ static struct ccb *ncr_get_ccb(struct ncb *np, struct scsi_cmnd *cmd)
qp = ncr_list_pop(&lp->free_ccbq);
if (qp) {
cp = list_entry(qp, struct ccb, link_ccbq);
- if (cp->magic) {
+ if (cp->busy) {
PRINT_ADDR(cmd, "ccb free list corrupted "
"(@%p)\n", cp);
cp = NULL;
@@ -7030,17 +7021,17 @@ static struct ccb *ncr_get_ccb(struct ncb *np, struct scsi_cmnd *cmd)
** Wait until available.
*/
#if 0
- while (cp->magic) {
+ while (cp->busy) {
if (flags & SCSI_NOSLEEP) break;
if (tsleep ((caddr_t)cp, PRIBIO|PCATCH, "ncr", 0))
break;
}
#endif
- if (cp->magic)
+ if (cp->busy)
return NULL;
- cp->magic = 1;
+ cp->busy = true;
/*
** Move to next available tag if tag used.
@@ -7119,7 +7110,7 @@ static void ncr_free_ccb (struct ncb *np, struct ccb *cp)
}
}
cp -> host_status = HS_IDLE;
- cp -> magic = 0;
+ cp -> busy = false;
if (cp->queued) {
--np->queuedccbs;
cp->queued = 0;
--
2.30.2
The list is now empty, and we've largely moved away from this approach,
and we have better debugging instrumentation nowadays
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/index.rst | 1 -
Documentation/process/magic-number.rst | 71 -----------------
.../translations/it_IT/process/index.rst | 1 -
.../it_IT/process/magic-number.rst | 77 -------------------
.../translations/zh_CN/process/index.rst | 1 -
.../zh_CN/process/magic-number.rst | 60 ---------------
.../translations/zh_TW/process/index.rst | 1 -
.../zh_TW/process/magic-number.rst | 63 ---------------
8 files changed, 275 deletions(-)
delete mode 100644 Documentation/process/magic-number.rst
delete mode 100644 Documentation/translations/it_IT/process/magic-number.rst
delete mode 100644 Documentation/translations/zh_CN/process/magic-number.rst
delete mode 100644 Documentation/translations/zh_TW/process/magic-number.rst
diff --git a/Documentation/process/index.rst b/Documentation/process/index.rst
index d4b6217472b0..a8c0c4bffa47 100644
--- a/Documentation/process/index.rst
+++ b/Documentation/process/index.rst
@@ -59,7 +59,6 @@ lack of a better place.
applying-patches
adding-syscalls
- magic-number
volatile-considered-harmful
botching-up-ioctls
clang-format
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
deleted file mode 100644
index 5a8c2755ac9c..000000000000
--- a/Documentation/process/magic-number.rst
+++ /dev/null
@@ -1,71 +0,0 @@
-.. _magicnumbers:
-
-Linux magic numbers
-===================
-
-This file is a registry of magic numbers which are in use. When you
-add a magic number to a structure, you should also add it to this
-file, since it is best if the magic numbers used by various structures
-are unique.
-
-It is a **very** good idea to protect kernel data structures with magic
-numbers. This allows you to check at run time whether (a) a structure
-has been clobbered, or (b) you've passed the wrong structure to a
-routine. This last is especially useful --- particularly when you are
-passing pointers to structures via a void * pointer. The tty code,
-for example, does this frequently to pass driver-specific and line
-discipline-specific structures back and forth.
-
-The way to use magic numbers is to declare them at the beginning of
-the structure, like so::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-Please follow this discipline when you are adding future enhancements
-to the kernel! It has saved me countless hours of debugging,
-especially in the screwy cases where an array has been overrun and
-structures following the array have been overwritten. Using this
-discipline, these cases get detected quickly and safely.
-
-Changelog::
-
- Theodore Ts'o
- 31 Mar 94
-
- The magic table is current to Linux 2.1.55.
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
- Now it should be up to date with Linux 2.1.112. Because
- we are in feature freeze time it is very unlikely that
- something will change before 2.2.x. The entries are
- sorted by number field.
-
- Krzysztof G. Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
- Updated the magic table to Linux 2.5.45. Right over the feature freeze,
- but it is possible that some new magic numbers will sneak into the
- kernel before 2.6.x yet.
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
- Updated the magic table to Linux 2.5.74.
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-
-===================== ================ ======================== ==========================================
-Magic Name Number Structure File
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/index.rst b/Documentation/translations/it_IT/process/index.rst
index 8d4e36a07ff4..71adf53bc297 100644
--- a/Documentation/translations/it_IT/process/index.rst
+++ b/Documentation/translations/it_IT/process/index.rst
@@ -56,7 +56,6 @@ perché non si è trovato un posto migliore.
applying-patches
adding-syscalls
- magic-number
volatile-considered-harmful
clang-format
../riscv/patch-acceptance
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
deleted file mode 100644
index 2fbc1876534a..000000000000
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ /dev/null
@@ -1,77 +0,0 @@
-.. include:: ../disclaimer-ita.rst
-
-:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
-:Translator: Federico Vaga <[email protected]>
-
-.. _it_magicnumbers:
-
-I numeri magici di Linux
-========================
-
-Questo documento è un registro dei numeri magici in uso. Quando
-aggiungete un numero magico ad una struttura, dovreste aggiungerlo anche
-a questo documento; la cosa migliore è che tutti i numeri magici usati
-dalle varie strutture siano unici.
-
-È **davvero** un'ottima idea proteggere le strutture dati del kernel con
-dei numeri magici. Questo vi permette in fase d'esecuzione di (a) verificare
-se una struttura è stata malmenata, o (b) avete passato a una procedura la
-struttura errata. Quest'ultimo è molto utile - particolarmente quando si passa
-una struttura dati tramite un puntatore void \*. Il codice tty, per esempio,
-effettua questa operazione con regolarità passando avanti e indietro le
-strutture specifiche per driver e discipline.
-
-Per utilizzare un numero magico, dovete dichiararlo all'inizio della struttura
-dati, come di seguito::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-Per favore, seguite questa direttiva quando aggiungerete migliorie al kernel!
-Mi ha risparmiato un numero illimitato di ore di debug, specialmente nei casi
-più ostici dove si è andati oltre la dimensione di un vettore e la struttura
-dati che lo seguiva in memoria è stata sovrascritta. Seguendo questa
-direttiva, questi casi vengono identificati velocemente e in sicurezza.
-
-Registro dei cambiamenti::
-
- Theodore Ts'o
- 31 Mar 94
-
- La tabella magica è aggiornata a Linux 2.1.55.
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
- Ora dovrebbe essere aggiornata a Linux 2.1.112. Dato che
- siamo in un momento di congelamento delle funzionalità
- (*feature freeze*) è improbabile che qualcosa cambi prima
- della versione 2.2.x. Le righe sono ordinate secondo il
- campo numero.
-
- Krzysztof G. Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
- Aggiornamento della tabella a Linux 2.5.45. Giusti nel congelamento
- delle funzionalità ma è comunque possibile che qualche nuovo
- numero magico s'intrufoli prima del kernel 2.6.x.
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
- Aggiornamento della tabella magica a Linux 2.5.74.
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-
-===================== ================ ======================== ==========================================
-Nome magico Numero Struttura File
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/index.rst b/Documentation/translations/zh_CN/process/index.rst
index a1a35f88f4ae..300d579b3ad0 100644
--- a/Documentation/translations/zh_CN/process/index.rst
+++ b/Documentation/translations/zh_CN/process/index.rst
@@ -52,7 +52,6 @@
.. toctree::
:maxdepth: 1
- magic-number
volatile-considered-harmful
.. only:: subproject and html
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
deleted file mode 100644
index f8ec4767bc4e..000000000000
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-.. _cn_magicnumbers:
-
-.. include:: ../disclaimer-zh_CN.rst
-
-:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
-
-如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可
-以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者::
-
- 中文版维护者: 贾威威 Jia Wei Wei <[email protected]>
- 中文版翻译者: 贾威威 Jia Wei Wei <[email protected]>
- 中文版校译者: 贾威威 Jia Wei Wei <[email protected]>
-
-Linux 魔术数
-============
-
-这个文件是有关当前使用的魔术值注册表。当你给一个结构添加了一个魔术值,你也应该把这个魔术值添加到这个文件,因为我们最好把用于各种结构的魔术值统一起来。
-
-使用魔术值来保护内核数据结构是一个非常好的主意。这就允许你在运行期检查(a)一个结构是否已经被攻击,或者(b)你已经给一个例行程序通过了一个错误的结构。后一种情况特别地有用---特别是当你通过一个空指针指向结构体的时候。tty源码,例如,经常通过特定驱动使用这种方法并且反复地排列特定方面的结构。
-
-使用魔术值的方法是在结构的开始处声明的,如下::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-当你以后给内核添加增强功能的时候,请遵守这条规则!这样就会节省数不清的调试时间,特别是一些古怪的情况,例如,数组超出范围并且重新写了超出部分。遵守这个规则,这些情况可以被快速地,安全地避免。
-
- Theodore Ts'o
- 31 Mar 94
-
-给当前的Linux 2.1.55添加魔术表。
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
-现在应该最新的Linux 2.1.112.因为在特性冻结期间,不能在2.2.x前改变任何东西。这些条目被数域所排序。
-
- Krzysztof G.Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
-更新魔术表到Linux 2.5.45。刚好越过特性冻结,但是有可能还会有一些新的魔术值在2.6.x之前融入到内核中。
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
-更新魔术表到Linux 2.5.74。
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-===================== ================ ======================== ==========================================
-魔术数名 数字 结构 文件
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/index.rst b/Documentation/translations/zh_TW/process/index.rst
index c5c59b4fd595..cb3dea0b78ab 100644
--- a/Documentation/translations/zh_TW/process/index.rst
+++ b/Documentation/translations/zh_TW/process/index.rst
@@ -54,7 +54,6 @@
.. toctree::
:maxdepth: 1
- magic-number
volatile-considered-harmful
.. only:: subproject and html
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
deleted file mode 100644
index 0ccc60bee3d6..000000000000
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ /dev/null
@@ -1,63 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-.. _tw_magicnumbers:
-
-.. include:: ../disclaimer-zh_TW.rst
-
-:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
-
-如果想評論或更新本文的內容,請直接發信到LKML。如果你使用英文交流有困難的話,也可
-以向中文版維護者求助。如果本翻譯更新不及時或者翻譯存在問題,請聯繫中文版維護者::
-
- 中文版維護者: 賈威威 Jia Wei Wei <[email protected]>
- 中文版翻譯者: 賈威威 Jia Wei Wei <[email protected]>
- 中文版校譯者: 賈威威 Jia Wei Wei <[email protected]>
- 胡皓文 Hu Haowen <[email protected]>
-
-Linux 魔術數
-============
-
-這個文件是有關當前使用的魔術值註冊表。當你給一個結構添加了一個魔術值,你也應該把這個魔術值添加到這個文件,因爲我們最好把用於各種結構的魔術值統一起來。
-
-使用魔術值來保護內核數據結構是一個非常好的主意。這就允許你在運行期檢查(a)一個結構是否已經被攻擊,或者(b)你已經給一個例行程序通過了一個錯誤的結構。後一種情況特別地有用---特別是當你通過一個空指針指向結構體的時候。tty源碼,例如,經常通過特定驅動使用這種方法並且反覆地排列特定方面的結構。
-
-使用魔術值的方法是在結構的開始處聲明的,如下::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-當你以後給內核添加增強功能的時候,請遵守這條規則!這樣就會節省數不清的調試時間,特別是一些古怪的情況,例如,數組超出範圍並且重新寫了超出部分。遵守這個規則,這些情況可以被快速地,安全地避免。
-
- Theodore Ts'o
- 31 Mar 94
-
-給當前的Linux 2.1.55添加魔術表。
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
-現在應該最新的Linux 2.1.112.因爲在特性凍結期間,不能在2.2.x前改變任何東西。這些條目被數域所排序。
-
- Krzysztof G.Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
-更新魔術表到Linux 2.5.45。剛好越過特性凍結,但是有可能還會有一些新的魔術值在2.6.x之前融入到內核中。
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
-更新魔術表到Linux 2.5.74。
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-===================== ================ ======================== ==========================================
-魔術數名 數字 結構 文件
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
--
2.30.2
We have largely moved away from this approach,
and we have better debugging instrumentation nowadays: kill it
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
.../translations/it_IT/process/magic-number.rst | 1 -
.../translations/zh_CN/process/magic-number.rst | 1 -
.../translations/zh_TW/process/magic-number.rst | 1 -
arch/x86/kernel/apm_32.c | 9 +--------
5 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index d8ffbc21872e..77a96a79c7e8 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -68,7 +68,6 @@ Changelog::
===================== ================ ======================== ==========================================
Magic Name Number Structure File
===================== ================ ======================== ==========================================
-APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 0e59704aa617..ef509265a3df 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -74,7 +74,6 @@ Registro dei cambiamenti::
===================== ================ ======================== ==========================================
Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
-APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 17a73661ef17..6437c408dd67 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -57,7 +57,6 @@ Linux 魔术数
===================== ================ ======================== ==========================================
魔术数名 数字 结构 文件
===================== ================ ======================== ==========================================
-APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 9d44d49b93bf..453cc205e6c3 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -60,7 +60,6 @@ Linux 魔術數
===================== ================ ======================== ==========================================
魔術數名 數字 結構 文件
===================== ================ ======================== ==========================================
-APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 60e330cdbd17..f3dd21dc56b7 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -330,7 +330,6 @@ extern int (*console_blank_hook)(int);
* The per-file APM data
*/
struct apm_user {
- int magic;
struct apm_user *next;
unsigned int suser: 1;
unsigned int writer: 1;
@@ -346,11 +345,6 @@ struct apm_user {
apm_event_t events[APM_MAX_EVENTS];
};
-/*
- * The magic number in apm_user
- */
-#define APM_BIOS_MAGIC 0x4101
-
/*
* idle percentage above which bios idle calls are done
*/
@@ -1459,7 +1453,7 @@ static void apm_mainloop(void)
static int check_apm_user(struct apm_user *as, const char *func)
{
- if (as == NULL || as->magic != APM_BIOS_MAGIC) {
+ if (as == NULL) {
pr_err("%s passed bad filp\n", func);
return 1;
}
@@ -1616,7 +1610,6 @@ static int do_open(struct inode *inode, struct file *filp)
if (as == NULL)
return -ENOMEM;
- as->magic = APM_BIOS_MAGIC;
as->event_tail = as->event_head = 0;
as->suspends_pending = as->standbys_pending = 0;
as->suspends_read = as->standbys_read = 0;
--
2.30.2
We have largely moved away from this approach,
and we have better debugging tooling nowadays: kill it
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
Documentation/translations/zh_TW/process/magic-number.rst | 1 -
fs/coda/cnode.c | 2 +-
fs/coda/coda_fs_i.h | 2 --
fs/coda/file.c | 1 -
7 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 18f8b1e3a993..335169e43be1 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -74,7 +74,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 827167b18f15..699b681088ac 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -80,7 +80,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 9553475e9867..d1ede86944f1 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -63,7 +63,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 8a64f56ae267..1dd01f1e1c17 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -66,7 +66,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index 62a3d2565c26..e217cca338bd 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -157,7 +157,7 @@ struct coda_file_info *coda_ftoc(struct file *file)
{
struct coda_file_info *cfi = file->private_data;
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ BUG_ON(!cfi);
return cfi;
diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h
index 1763ff95d865..9e4b54dbe7d7 100644
--- a/fs/coda/coda_fs_i.h
+++ b/fs/coda/coda_fs_i.h
@@ -35,9 +35,7 @@ struct coda_inode_info {
/*
* coda fs file private data
*/
-#define CODA_MAGIC 0xC0DAC0DA
struct coda_file_info {
- int cfi_magic; /* magic number */
struct file *cfi_container; /* container file for this cnode */
unsigned int cfi_mapcount; /* nr of times this file is mapped */
bool cfi_access_intent; /* is access intent supported */
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 3f3c81e6b1ab..c23f846bf206 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -222,7 +222,6 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)
host_file->f_flags |= coda_file->f_flags & (O_APPEND | O_SYNC);
- cfi->cfi_magic = CODA_MAGIC;
cfi->cfi_mapcount = 0;
cfi->cfi_container = host_file;
/* assume access intents are supported unless we hear otherwise */
--
2.30.2
It's part of the userspace I/O packet protocol
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
Documentation/translations/zh_TW/process/magic-number.rst | 1 -
4 files changed, 4 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 335169e43be1..62a3a2113e7c 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -68,7 +68,6 @@ Changelog::
===================== ================ ======================== ==========================================
Magic Name Number Structure File
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 699b681088ac..b20a54ee6fb2 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -74,7 +74,6 @@ Registro dei cambiamenti::
===================== ================ ======================== ==========================================
Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index d1ede86944f1..e7781ab923f7 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -57,7 +57,6 @@ Linux 魔术数
===================== ================ ======================== ==========================================
魔术数名 数字 结构 文件
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 1dd01f1e1c17..5cc0bfa97d9d 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -60,7 +60,6 @@ Linux 魔術數
===================== ================ ======================== ==========================================
魔術數名 數字 結構 文件
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
--
2.30.2
According to Greg, in the context of magic numbers as defined in
magic-number.rst, "the tty layer should not need this and I'll gladly
take patches"
We have largely moved away from this approach,
and we have better debugging instrumentation nowadays: kill it
Additionally, all SLIP_MAGIC checks just early-exit instead
of noting the bug, so they're detrimental, if anything
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
.../translations/it_IT/process/magic-number.rst | 1 -
.../translations/zh_CN/process/magic-number.rst | 1 -
.../translations/zh_TW/process/magic-number.rst | 1 -
drivers/net/slip/slip.c | 11 +++++------
drivers/net/slip/slip.h | 4 ----
6 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 3b3e607e1cbc..e59c707ec785 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -69,6 +69,5 @@ Changelog::
Magic Name Number Structure File
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
-SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index e8c659b6a743..37a539867b6f 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -75,6 +75,5 @@ Registro dei cambiamenti::
Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
-SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 2105af32187c..8a3a3e872c52 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -58,6 +58,5 @@ Linux 魔术数
魔术数名 数字 结构 文件
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
-SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 793a0ae9fb7c..7ace7834f7f9 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -61,6 +61,5 @@ Linux 魔術數
魔術數名 數字 結構 文件
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
-SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
===================== ================ ======================== ==========================================
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index 6865d32270e5..95f5c79772e7 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -426,7 +426,7 @@ static void slip_transmit(struct work_struct *work)
spin_lock_bh(&sl->lock);
/* First make sure we're connected. */
- if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) {
+ if (!sl->tty || !netif_running(sl->dev)) {
spin_unlock_bh(&sl->lock);
return;
}
@@ -690,7 +690,7 @@ static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
{
struct slip *sl = tty->disc_data;
- if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
+ if (!sl || !netif_running(sl->dev))
return;
/* Read the characters out of the buffer */
@@ -761,7 +761,6 @@ static struct slip *sl_alloc(void)
sl = netdev_priv(dev);
/* Initialize channel control data */
- sl->magic = SLIP_MAGIC;
sl->dev = dev;
spin_lock_init(&sl->lock);
INIT_WORK(&sl->tx_work, slip_transmit);
@@ -809,7 +808,7 @@ static int slip_open(struct tty_struct *tty)
err = -EEXIST;
/* First make sure we're not already connected. */
- if (sl && sl->magic == SLIP_MAGIC)
+ if (sl)
goto err_exit;
/* OK. Find a free SLIP channel to use. */
@@ -886,7 +885,7 @@ static void slip_close(struct tty_struct *tty)
struct slip *sl = tty->disc_data;
/* First make sure we're connected. */
- if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty)
+ if (!sl || sl->tty != tty)
return;
spin_lock_bh(&sl->lock);
@@ -1080,7 +1079,7 @@ static int slip_ioctl(struct tty_struct *tty, unsigned int cmd,
int __user *p = (int __user *)arg;
/* First make sure we're connected. */
- if (!sl || sl->magic != SLIP_MAGIC)
+ if (!sl)
return -EINVAL;
switch (cmd) {
diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h
index 3d7f88b330c1..d7dbedd27669 100644
--- a/drivers/net/slip/slip.h
+++ b/drivers/net/slip/slip.h
@@ -50,8 +50,6 @@
struct slip {
- int magic;
-
/* Various fields. */
struct tty_struct *tty; /* ptr to TTY structure */
struct net_device *dev; /* easy for intr handling */
@@ -100,6 +98,4 @@ struct slip {
#endif
};
-#define SLIP_MAGIC 0x5302
-
#endif /* _LINUX_SLIP.H */
--
2.30.2
We have largely moved away from this approach,
and we have better debugging instrumentation nowadays: kill it
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 2 --
.../it_IT/process/magic-number.rst | 2 --
.../zh_CN/process/magic-number.rst | 2 --
.../zh_TW/process/magic-number.rst | 2 --
drivers/scsi/arm/queue.c | 21 -------------------
5 files changed, 29 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 77a96a79c7e8..c1c68c713cbc 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -72,6 +72,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index ef509265a3df..5b609ca78a14 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -78,6 +78,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 6437c408dd67..ab4d4e32b61f 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -61,6 +61,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 453cc205e6c3..a6131d978189 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -64,6 +64,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/drivers/scsi/arm/queue.c b/drivers/scsi/arm/queue.c
index 978df23ce188..fe7d814a73a9 100644
--- a/drivers/scsi/arm/queue.c
+++ b/drivers/scsi/arm/queue.c
@@ -26,27 +26,11 @@
#include <scsi/scsi_eh.h>
#include <scsi/scsi_tcq.h>
-#define DEBUG
-
typedef struct queue_entry {
struct list_head list;
struct scsi_cmnd *SCpnt;
-#ifdef DEBUG
- unsigned long magic;
-#endif
} QE_t;
-#ifdef DEBUG
-#define QUEUE_MAGIC_FREE 0xf7e1c9a3
-#define QUEUE_MAGIC_USED 0xf7e1cc33
-
-#define SET_MAGIC(q,m) ((q)->magic = (m))
-#define BAD_MAGIC(q,m) ((q)->magic != (m))
-#else
-#define SET_MAGIC(q,m) do { } while (0)
-#define BAD_MAGIC(q,m) (0)
-#endif
-
#include "queue.h"
#define NR_QE 32
@@ -74,7 +58,6 @@ int queue_initialise (Queue_t *queue)
queue->alloc = q = kmalloc_array(nqueues, sizeof(QE_t), GFP_KERNEL);
if (q) {
for (; nqueues; q++, nqueues--) {
- SET_MAGIC(q, QUEUE_MAGIC_FREE);
q->SCpnt = NULL;
list_add(&q->list, &queue->free);
}
@@ -119,9 +102,7 @@ int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head)
list_del(l);
q = list_entry(l, QE_t, list);
- BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_FREE));
- SET_MAGIC(q, QUEUE_MAGIC_USED);
q->SCpnt = SCpnt;
if (head)
@@ -144,9 +125,7 @@ static struct scsi_cmnd *__queue_remove(Queue_t *queue, struct list_head *ent)
*/
list_del(ent);
q = list_entry(ent, QE_t, list);
- BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_USED));
- SET_MAGIC(q, QUEUE_MAGIC_FREE);
list_add(ent, &queue->free);
return q->SCpnt;
--
2.30.2
MGSLPC_PARANOIA_CHECK has never been defined automatically,
and in the context of magic numbers as defined in magic-number.rst,
"the tty layer should not need this"
This is 100% dead cruft, and we have better debugging tooling nowadays:
kill it
Ref: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
.../translations/it_IT/process/magic-number.rst | 1 -
.../translations/zh_CN/process/magic-number.rst | 1 -
.../translations/zh_TW/process/magic-number.rst | 1 -
drivers/char/pcmcia/synclink_cs.c | 10 ----------
5 files changed, 14 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index a4414b7e15aa..18f8b1e3a993 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -72,7 +72,6 @@ PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index f51c5ef9d93f..827167b18f15 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -78,7 +78,6 @@ PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 3b53bd67e41b..9553475e9867 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -61,7 +61,6 @@ PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 7d176a87ec3c..8a64f56ae267 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -64,7 +64,6 @@ PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
-MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index b2735be81ab2..262f087bfc01 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -137,7 +137,6 @@ struct _input_signal_events {
typedef struct _mgslpc_info {
struct tty_port port;
void *if_ptr; /* General purpose pointer (used by SPPP) */
- int magic;
int line;
struct mgsl_icount icount;
@@ -228,8 +227,6 @@ typedef struct _mgslpc_info {
} MGSLPC_INFO;
-#define MGSLPC_MAGIC 0x5402
-
/*
* The size of the serial xmit buffer is 1 page, or 4096 bytes
*/
@@ -525,7 +522,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
return -ENOMEM;
}
- info->magic = MGSLPC_MAGIC;
tty_port_init(&info->port);
info->port.ops = &mgslpc_port_ops;
INIT_WORK(&info->task, bh_handler);
@@ -652,8 +648,6 @@ static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info,
char *name, const char *routine)
{
#ifdef MGSLPC_PARANOIA_CHECK
- static const char *badmagic =
- "Warning: bad magic number for mgsl struct (%s) in %s\n";
static const char *badinfo =
"Warning: null mgslpc_info for (%s) in %s\n";
@@ -661,10 +655,6 @@ static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info,
printk(badinfo, name, routine);
return true;
}
- if (info->magic != MGSLPC_MAGIC) {
- printk(badmagic, name, routine);
- return true;
- }
#else
if (!info)
return true;
--
2.30.2
On Thu, 27 Oct 2022 00:42:37 +0200 наб wrote:
> Since defanging in v2.6.12-rc1 it's set exactly once per port on probe
> and checked exactly once per port on unload: it's useless. Kill it.
>
> Notably, magic-number.rst has never had the right value for it with the
> new-in-2.1.105 network-based driver
>
> Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Interesting name :S Just to be clear full legal names are required.
Not saying that's not your name, just saying I haven't heard it before.
Plus the From line must be the same, legal name.
> Ref: https://lore.kernel.org/linux-doc/[email protected]/
Link: is the tag we use.
Otherwise looks fine.
On Thu, Oct 27, 2022 at 1:42 AM наб <[email protected]> wrote:
>
> MGSLPC_PARANOIA_CHECK has never been defined automatically,
> and devices with null driver_info can't happen, since we reject the open
> in that case
>
> Move the log statement from dead code to the check,
> and log the state inconsistency like we do above for the line count
> ("invalid line #%d.")
Please, respect English grammar and punctuation, in particular don't
forget the trailing periods.
...
> + if (!info) {
> + printk(KERN_WARNING "%s(%d):mgslpc_open: "
> + "no device for line #%d.\n",
> + __FILE__, __LINE__, line);
Even though the old code uses this awkward style for messages, please
follow the modern one, i.e.
pr_warn("mgslpc_open: no device for line #%d.\n", line);
> return -ENODEV;
> + }
--
With Best Regards,
Andy Shevchenko
On Thu, Oct 27, 2022 at 07:53:34AM +0300, Andy Shevchenko wrote:
> On Thu, Oct 27, 2022 at 1:42 AM наб <[email protected]> wrote:
> > in that case
> > ("invalid line #%d.")
>
> Please, respect English grammar and punctuation, in particular don't
> forget the trailing periods.
>
> > + if (!info) {
> > + printk(KERN_WARNING "%s(%d):mgslpc_open: "
> > + "no device for line #%d.\n",
> > + __FILE__, __LINE__, line);
>
> Even though the old code uses this awkward style for messages, please
> follow the modern one, i.e.
>
> pr_warn("mgslpc_open: no device for line #%d.\n", line);
Both applied for v2.
наб
On Thu, Oct 27, 2022 at 03:11:56PM +0200, Oliver Hartkopp wrote:
> I'm not sure why I'm in 'To' here as I'm definitely not the official
> maintainer of slip.
>
> But it looks like there is no real maintainer anyway but maybe Jiri ;-)
According to get_maintainer.pl,
(which I just shoved into Cc: indiscriminately,
lacking any knowledge to the contrary),
you get picked up for slip.{c,h} as commit_signer:2/4=50% and 1/2, resp.
As does Jiri, so on that front we're good at least.
Best,
Hi,
I'm not sure why I'm in 'To' here as I'm definitely not the official
maintainer of slip.
But it looks like there is no real maintainer anyway but maybe Jiri ;-)
On 27.10.22 00:43, наб wrote:
> According to Greg, in the context of magic numbers as defined in
> magic-number.rst, "the tty layer should not need this and I'll gladly
> take patches"
>
> We have largely moved away from this approach,
> and we have better debugging instrumentation nowadays: kill it
>
> Additionally, all SLIP_MAGIC checks just early-exit instead
> of noting the bug, so they're detrimental, if anything
>
> Ref: https://lore.kernel.org/linux-doc/[email protected]/
> Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Reviewed-by: Oliver Hartkopp <[email protected]>
Many thanks!
Oliver
> ---
> Documentation/process/magic-number.rst | 1 -
> .../translations/it_IT/process/magic-number.rst | 1 -
> .../translations/zh_CN/process/magic-number.rst | 1 -
> .../translations/zh_TW/process/magic-number.rst | 1 -
> drivers/net/slip/slip.c | 11 +++++------
> drivers/net/slip/slip.h | 4 ----
> 6 files changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
> index 3b3e607e1cbc..e59c707ec785 100644
> --- a/Documentation/process/magic-number.rst
> +++ b/Documentation/process/magic-number.rst
> @@ -69,6 +69,5 @@ Changelog::
> Magic Name Number Structure File
> ===================== ================ ======================== ==========================================
> FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
> -SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
> CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
> ===================== ================ ======================== ==========================================
> diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
> index e8c659b6a743..37a539867b6f 100644
> --- a/Documentation/translations/it_IT/process/magic-number.rst
> +++ b/Documentation/translations/it_IT/process/magic-number.rst
> @@ -75,6 +75,5 @@ Registro dei cambiamenti::
> Nome magico Numero Struttura File
> ===================== ================ ======================== ==========================================
> FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
> -SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
> CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
> ===================== ================ ======================== ==========================================
> diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
> index 2105af32187c..8a3a3e872c52 100644
> --- a/Documentation/translations/zh_CN/process/magic-number.rst
> +++ b/Documentation/translations/zh_CN/process/magic-number.rst
> @@ -58,6 +58,5 @@ Linux 魔术数
> 魔术数名 数字 结构 文件
> ===================== ================ ======================== ==========================================
> FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
> -SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
> CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
> ===================== ================ ======================== ==========================================
> diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
> index 793a0ae9fb7c..7ace7834f7f9 100644
> --- a/Documentation/translations/zh_TW/process/magic-number.rst
> +++ b/Documentation/translations/zh_TW/process/magic-number.rst
> @@ -61,6 +61,5 @@ Linux 魔術數
> 魔術數名 數字 結構 文件
> ===================== ================ ======================== ==========================================
> FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
> -SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
> CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
> ===================== ================ ======================== ==========================================
> diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
> index 6865d32270e5..95f5c79772e7 100644
> --- a/drivers/net/slip/slip.c
> +++ b/drivers/net/slip/slip.c
> @@ -426,7 +426,7 @@ static void slip_transmit(struct work_struct *work)
>
> spin_lock_bh(&sl->lock);
> /* First make sure we're connected. */
> - if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) {
> + if (!sl->tty || !netif_running(sl->dev)) {
> spin_unlock_bh(&sl->lock);
> return;
> }
> @@ -690,7 +690,7 @@ static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
> {
> struct slip *sl = tty->disc_data;
>
> - if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
> + if (!sl || !netif_running(sl->dev))
> return;
>
> /* Read the characters out of the buffer */
> @@ -761,7 +761,6 @@ static struct slip *sl_alloc(void)
> sl = netdev_priv(dev);
>
> /* Initialize channel control data */
> - sl->magic = SLIP_MAGIC;
> sl->dev = dev;
> spin_lock_init(&sl->lock);
> INIT_WORK(&sl->tx_work, slip_transmit);
> @@ -809,7 +808,7 @@ static int slip_open(struct tty_struct *tty)
>
> err = -EEXIST;
> /* First make sure we're not already connected. */
> - if (sl && sl->magic == SLIP_MAGIC)
> + if (sl)
> goto err_exit;
>
> /* OK. Find a free SLIP channel to use. */
> @@ -886,7 +885,7 @@ static void slip_close(struct tty_struct *tty)
> struct slip *sl = tty->disc_data;
>
> /* First make sure we're connected. */
> - if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty)
> + if (!sl || sl->tty != tty)
> return;
>
> spin_lock_bh(&sl->lock);
> @@ -1080,7 +1079,7 @@ static int slip_ioctl(struct tty_struct *tty, unsigned int cmd,
> int __user *p = (int __user *)arg;
>
> /* First make sure we're connected. */
> - if (!sl || sl->magic != SLIP_MAGIC)
> + if (!sl)
> return -EINVAL;
>
> switch (cmd) {
> diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h
> index 3d7f88b330c1..d7dbedd27669 100644
> --- a/drivers/net/slip/slip.h
> +++ b/drivers/net/slip/slip.h
> @@ -50,8 +50,6 @@
>
>
> struct slip {
> - int magic;
> -
> /* Various fields. */
> struct tty_struct *tty; /* ptr to TTY structure */
> struct net_device *dev; /* easy for intr handling */
> @@ -100,6 +98,4 @@ struct slip {
> #endif
> };
>
> -#define SLIP_MAGIC 0x5302
> -
> #endif /* _LINUX_SLIP.H */
Hi,
Thanks for working on this patchset. The magic-number.rst file has
always kind of bothered me with its outdated encouragements to magic up
every struct.
Technically, this series seems okay. It'd be nice if somebody had some
SGI hardware to figure out what NMI_MAGIC is all about, but that doesn't
need to block removing it from magic-number.rst, so that
magic-number.rst can be put to rest. Interestingly, though,
0x48414d4d455201 is "HAMMER\x01". The only reference to it I could find
on the Internet that wasn't this file itself was some forum on Intel
stuff? https://www.eevblog.com/forum/microcontrollers/intel-bare-metal-programming/msg1273587/#msg1273587
No idea.
Anyway, I suspect the actual issues that remain are mostly formalities,
as others have mentioned:
1) Add a 00/15 cover letter that explains your intentions, and make sure
the "right people" are CC'd on that. Hard to say who that might be,
given how diverse this patchset is. Maybe Andrew Morton? Or Kees
Cook? No idea.
2) Fix up your commit messages:
> The only user is arch/mips/sgi-ip27/ip27-nmi.c;
> this file was imported wholesale in 2.3.99pre9-1,
> and received only whitespace updates since then
>
> NMI_MAGIC isn't a magic number; it's unclear if it's actually used
> by the firmware in some capacity or if it's a holdover from copying
> the SGI code, but in the former case it's API
> and in the latter it's dead cruft
>
> Lack of QEMU support makes this unvalidatable without the hardware,
> so leave it in
Add some trailing periods, and reformat this to have the usual
alignment. `gq` in vim will do that for you. So for that message, it
should become:
| The only user is arch/mips/sgi-ip27/ip27-nmi.c; this file was imported
| wholesale in 2.3.99pre9-1, and received only whitespace updates since
| then.
|
| NMI_MAGIC isn't a magic number; it's unclear if it's actually used by
| the firmware in some capacity or if it's a holdover from copying the
| SGI code, but in the former case it's API and in the latter it's dead
| cruft.
|
| Lack of QEMU support makes this unvalidatable without the hardware, so
| leave it in.
3) Ensure the "From:" header of your email matches your Signed-off-by:
trailer.
4) Use "Link: " instead of "Ref: ", and make sure all of your tags are
*above* your Signed-off-by:, not below.
5) Figure out what your name actually is. If it's fake (as somebody
earlier suggested), either don't make it fake, or don't get caught
with it being fake in some obvious way, as the kernel supposedly
requires real names (George Spelvin notwithstanding). Probably (3) is
enough to take care of this though.
I realize this is likely annoying administrivia. Sorry. So it goes with
Linux stuff.
Jason
On 10/27/22 08:37, Jakub Kicinski wrote:
> On Thu, 27 Oct 2022 00:42:37 +0200 наб wrote:
>> Since defanging in v2.6.12-rc1 it's set exactly once per port on probe
>> and checked exactly once per port on unload: it's useless. Kill it.
>>
>> Notably, magic-number.rst has never had the right value for it with the
>> new-in-2.1.105 network-based driver
>>
>> Signed-off-by: Ahelenia Ziemiańska <[email protected]>
>
> Interesting name :S Just to be clear full legal names are required.
> Not saying that's not your name, just saying I haven't heard it before.
>
> Plus the From line must be the same, legal name.
>
You mean From header (email).
In this case, she forgot to add From: tag before the patch description
(which could be easily added with --from option to git-format-patch(1)).
Thanks.
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:42, наб wrote:
> Since defanging in v2.6.12-rc1 it's set exactly once per port on probe
> and checked exactly once per port on unload: it's useless. Kill it.
>
What do you mean by defanging in that release?
Also, s/Kill it/Remove BAYCOM_MAGIC from magic numbers table/ (your
wording is kinda mature).
> Notably, magic-number.rst has never had the right value for it with the
> new-in-2.1.105 network-based driver
>
> Signed-off-by: Ahelenia Ziemiańska <[email protected]>
> Ref: https://lore.kernel.org/linux-doc/[email protected]/
Use Link: tag instead.
Thanks.
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:42, наб wrote:
> This is 100% dead cruft, and we have better debugging tooling nowadays:
> kill it
>
Again, same reply as [1].
Also, ask yourself: what are better ways to do debugging kernel (including
tools) than relying to magic numbers?
Thanks.
[1]: https://lore.kernel.org/linux-doc/[email protected]/
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> It appeared in the original import of SGI code in 2.4.0-test3pre8
> and has never been used anywhere
>
LGTM, thanks.
Reviewed-by: Bagas Sanjaya <[email protected]>
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> We have largely moved away from this approach,
> and we have better debugging instrumentation nowadays: kill it
>
Again, see [1] and [2].
Also, please write the patch description in imperative mood, not
descriptive not even in first-person POV.
[1]: https://lore.kernel.org/linux-doc/[email protected]/
[2]: https://lore.kernel.org/linux-doc/[email protected]/
Thanks.
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:42, наб wrote:
> We have largely moved away from this approach,
> and we have better debugging tooling nowadays: kill it
>
Again, see [1] and [2].
[1]: https://lore.kernel.org/linux-doc/[email protected]/
[2]: https://lore.kernel.org/linux-doc/[email protected]/
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> We have largely moved away from this approach,
> and we have better debugging instrumentation nowadays: kill it
>
Same reply as [1].
[1]: https://lore.kernel.org/linux-doc/[email protected]/
--
An old man doll... just what I always wanted! - Clara
On Fri, Oct 28, 2022 at 08:13:49PM +0700, Bagas Sanjaya wrote:
> On 10/27/22 05:42, наб wrote:
> > Since defanging in v2.6.12-rc1 it's set exactly once per port on probe
> > and checked exactly once per port on unload: it's useless. Kill it.
> >
>
> What do you mean by defanging in that release?
I was also curious about this, but I accidentally sent my question
privately instead of to the list.
>
> Also, s/Kill it/Remove BAYCOM_MAGIC from magic numbers table/ (your
> wording is kinda mature).
>
The kernel has almost 13 thousand kills...
$ git grep -i kill | wc -l
12975
$
It's fine.
regards,
dan carpenter
On 10/27/22 05:43, наб wrote:
> Lack of QEMU support makes this unvalidatable without the hardware,
> so leave it in
Shouldn't this say "remove the magic number" instead?
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> It's part of the userspace I/O packet protocol
>
The patch subject should have been "Documentation: remove PG_MAGIC".
Otherwise LGTM.
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> As for magic numbers, we have largely moved away from this approach,
> and we have better debugging instrumentation nowadays: kill it
>
Meh, see [1] for the same reply.
[1]: https://lore.kernel.org/linux-doc/[email protected]/
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> We have largely moved away from this approach,
> and we have better debugging instrumentation nowadays: kill it
>
> Additionally, all SLIP_MAGIC checks just early-exit instead
> of noting the bug, so they're detrimental, if anything
>
Same reply as [1].
[1]: https://lore.kernel.org/linux-doc/[email protected]/
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> We have largely moved away from this approach,
> and we have better debugging instrumentation nowadays: kill it
>
Again, see [1].
[1]: https://lore.kernel.org/linux-doc/[email protected]/
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> We have largely moved away from this approach,
> and we have better debugging instrumentation nowadays: kill it
>
Same reply as [1].
> Additionally, ~half HDLCDRV_MAGIC checks just early-exit instead
> of noting the bug, so they're detrimental, if anything
>
"... instead of handling the magic number"?
Thanks.
[1]: https://lore.kernel.org/linux-doc/[email protected]/
--
An old man doll... just what I always wanted! - Clara
On Fri, Oct 28, 2022 at 08:50:59PM +0700, Bagas Sanjaya wrote:
> On 10/28/22 20:43, Dan Carpenter wrote:
> >>
> >> Also, s/Kill it/Remove BAYCOM_MAGIC from magic numbers table/ (your
> >> wording is kinda mature).
> >>
> >
> > The kernel has almost 13 thousand kills...
> >
> > $ git grep -i kill | wc -l
> > 12975
> > $
> >
> > It's fine.
> >
>
> The word meaning depends on context. In this case, the author means
> removing SOME_MAGIC magic number from the table, one by one until
> the magic number documentation is removed (due to historical cruft).
Kernel devs are naturally blood thirsty people...
$ git log --after=2022-01-01 | grep -w kill | wc -l
207
When people talk about killing stuff they mostly mean deleting code.
Look at this sample of the very first kills from January. Seven out
of ten times this is what they meant.
$ git log --after=2022-01-01 | grep -w kill | head -n 10
useless now, kill it.
net: ipa: kill ipa_table_valid()
net: ipa: kill two constant symbols
io_uring: kill hot path fixed file bitmap debug checks
newattrs.ia_valid = ATTR_FORCE | kill;
newattrs.ia_valid = ATTR_FORCE | kill;
newattrs.ia_valid = attr_force | kill;
kill it off before it ends up in a release. It was just part of the
io_uring: kill hot path fixed file bitmap debug checks
block: kill deprecated BUG_ON() in the flush handling
$
regards,
dan carpenter
On 10/28/22 20:43, Dan Carpenter wrote:
>>
>> Also, s/Kill it/Remove BAYCOM_MAGIC from magic numbers table/ (your
>> wording is kinda mature).
>>
>
> The kernel has almost 13 thousand kills...
>
> $ git grep -i kill | wc -l
> 12975
> $
>
> It's fine.
>
The word meaning depends on context. In this case, the author means
removing SOME_MAGIC magic number from the table, one by one until
the magic number documentation is removed (due to historical cruft).
Thanks.
--
An old man doll... just what I always wanted! - Clara
On 10/27/22 05:43, наб wrote:
> The list is now empty, and we've largely moved away from this approach,
> and we have better debugging instrumentation nowadays
>
The patch subject should be "Documentation: remove magic number
documentation".
Better say for the description "Now that all magic numbers have
been removed, remove the documentation".
Thanks.
--
An old man doll... just what I always wanted! - Clara
On Fri, Oct 28, 2022 at 08:23:38PM +0700, Bagas Sanjaya wrote:
> On 10/27/22 05:42, наб wrote:
> > We have largely moved away from this approach,
> > and we have better debugging tooling nowadays: kill it
> >
>
> Again, see [1] and [2].
>
> [1]: https://lore.kernel.org/linux-doc/[email protected]/
> [2]: https://lore.kernel.org/linux-doc/[email protected]/
I guess I must be old-school because I appreciate magic numbers and
assertions to catch situations that should obviously never happen.
This https://lkml.org/lkml/2019/4/2/923 bug would have been caught a lot
sooner if ext4 had happened to check a magic number in vma->vm_file. As
it was, we ended up passing a Coda file instead of a file handle for the
the underlying filesystem which then ended up with the wrong inode and
their mmap_sem happened to scribble the spinlock on the Coda inode.
This wasn't really ext4's fault, it wasn't expecting to get a mmapped
region with another file system's file handle, but that is exactly the
point of these magic numbers, to catch the unexpected. Not sure what
better debug tooling would catch that unless you were already expecting
the problem.
Jan
On Fri, Oct 28, 2022 at 08:13:49PM +0700, Bagas Sanjaya wrote:
> On 10/27/22 05:42, наб wrote:
> > Since defanging in v2.6.12-rc1 it's set exactly once per port on probe
> > and checked exactly once per port on unload: it's useless. Kill it.
> >
>
> What do you mean by defanging in that release?
Before v2.6.12-rc1, there were baycom_paranoia_check{,_void}() macros
(which logged at KERN_ERR and returned an error),
used before each netdev_priv(); after, this is reduced to the single
check in the cleanup we observe presently.
I've rephrased the message to make it more palatable.
Best,