From: Oliver Hartkopp <socketcan@hartkopp.net>
To: наб <nabijaczleweli@nabijaczleweli.xyz>,
"Jiri Slaby" <jirislaby@kernel.org>
Cc: "Jonathan Corbet" <corbet@lwn.net>,
"Federico Vaga" <federico.vaga@vaga.pv.it>,
"Alex Shi" <alexs@kernel.org>,
"Yanteng Si" <siyanteng@loongson.cn>,
"Hu Haowen" <src.res@email.cn>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kiciński" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Duoming Zhou" <duoming@zju.edu.cn>,
"Huang Pei" <huangpei@loongson.cn>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc-tw-discuss@lists.sourceforge.net,
netdev@vger.kernel.org
Subject: Re: [PATCH 12/15] drivers: net: slip: remove SLIP_MAGIC
Date: Thu, 27 Oct 2022 15:11:56 +0200 [thread overview]
Message-ID: <31c8f481-aeec-daf8-92d7-016824f88760@hartkopp.net> (raw)
In-Reply-To: <f5f9036f2a488886fe5a424d8143e8f2f3fdcf3f.1666822928.git.nabijaczleweli@nabijaczleweli.xyz>
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/YyMlovoskUcHLEb7@kroah.com/
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net>
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 */
next prev parent reply other threads:[~2022-10-27 13:15 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-26 22:42 [PATCH 01/15] hamradio: baycom: remove BAYCOM_MAGIC наб
2022-10-26 22:42 ` [PATCH 02/15] hamradio: yam: remove YAM_MAGIC наб
2022-10-28 13:19 ` Bagas Sanjaya
2022-10-28 13:44 ` Dan Carpenter
2022-10-26 22:42 ` [PATCH 03/15] pcmcia: synclink_cs: remove MGSLPC_MAGIC наб
2022-10-28 13:21 ` Bagas Sanjaya
2022-10-26 22:42 ` [PATCH 04/15] pcmcia: synclink_cs: remove dead paranoia_check, warn for missing line наб
2022-10-27 4:53 ` Andy Shevchenko
2022-10-27 11:31 ` наб
2022-10-26 22:42 ` [PATCH 05/15] coda: remove CODA_MAGIC наб
2022-10-28 13:23 ` Bagas Sanjaya
2022-10-28 16:54 ` Jan Harkes
2022-10-26 22:43 ` [PATCH 06/15] Documentation: PG_MAGIC isn't a magic number наб
2022-10-28 13:39 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 07/15] MIPS: IP27: clean out sn/nmi.h наб
2022-10-27 12:26 ` Jason A. Donenfeld
2022-10-28 13:40 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 08/15] MIPS: IP27: remove KV_MAGIC наб
2022-10-28 13:42 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 09/15] x86/APM: remove APM_BIOS_MAGIC наб
2022-10-28 13:45 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 10/15] scsi: acorn: remove QUEUE_MAGIC_{FREE,USED} наб
2022-10-28 13:48 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 11/15] hdlcdrv: remove HDLCDRV_MAGIC наб
2022-10-28 13:54 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 12/15] drivers: net: slip: remove SLIP_MAGIC наб
2022-10-27 13:11 ` Oliver Hartkopp [this message]
2022-10-27 13:45 ` наб
2022-10-28 13:57 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 13/15] fcntl: remove FASYNC_MAGIC наб
2022-10-28 13:59 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 14/15] scsi: ncr53c8xx: replace CCB_MAGIC with bool busy наб
2022-10-28 14:01 ` Bagas Sanjaya
2022-10-26 22:43 ` [PATCH 15/15] Documentation: bury magic-number, now devoid of content наб
2022-10-28 14:04 ` Bagas Sanjaya
2022-10-27 1:37 ` [PATCH 01/15] hamradio: baycom: remove BAYCOM_MAGIC Jakub Kicinski
2022-10-28 1:54 ` Bagas Sanjaya
2022-10-28 13:13 ` Bagas Sanjaya
2022-10-28 13:43 ` Dan Carpenter
2022-10-28 13:50 ` Bagas Sanjaya
2022-10-28 14:07 ` Dan Carpenter
2022-10-28 21:43 ` наб
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31c8f481-aeec-daf8-92d7-016824f88760@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=alexs@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=duoming@zju.edu.cn \
--cc=edumazet@google.com \
--cc=federico.vaga@vaga.pv.it \
--cc=gregkh@linuxfoundation.org \
--cc=huangpei@loongson.cn \
--cc=jirislaby@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc-tw-discuss@lists.sourceforge.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=nabijaczleweli@nabijaczleweli.xyz \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=siyanteng@loongson.cn \
--cc=src.res@email.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®