linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Federico Vaga <federico.vaga@vaga.pv.it>,
	Alex Shi <alexs@kernel.org>, Yanteng Si <siyanteng@loongson.cn>,
	Hu Haowen <src.res@email.cn>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc-tw-discuss@lists.sourceforge.net
Subject: Re: [PATCH 1/5] tty: remove TTY_MAGIC
Date: Fri, 16 Sep 2022 03:33:53 -0400	[thread overview]
Message-ID: <YyQm4dBVyvefVcAd@mit.edu> (raw)
In-Reply-To: <476d024cd6b04160a5de381ea2b9856b60088cbd.1663288066.git.nabijaczleweli@nabijaczleweli.xyz>

On Fri, Sep 16, 2022 at 03:54:59AM +0200, наб 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"
> 
> Ref: https://lore.kernel.org/linux-doc/YyMlovoskUcHLEb7@kroah.com/

Well, I would disagree with Greg K-H on this --- but I haven't been
tty maintainer in well over a decade.  Assuming code is Bug-Free(tm),
sure, it's not necessary.  But there is any kind of memory bug (e.g.,
a corrupted pointer, a use-after free, some other structure
corruption), this catches the problem earlier rather than later, and
it's a light-weight to do a quick sanity check.

It has certainly caught problems in the past, and I still use this
programming technique in programs that I do maintain, such as
e2fsprogs.

But it's not a big deal either way,

						- Ted

P.S. BTW, I didn't make up this technique; it's a program pattern
first used in Multics.

  parent reply	other threads:[~2022-09-16  7:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16  1:54 [PATCH 1/5] tty: remove TTY_MAGIC наб
2022-09-16  1:55 ` [PATCH 2/5] tty: remove TTY_DRIVER_MAGIC наб
2022-09-16  6:51   ` Jiri Slaby
2022-09-16  1:55 ` [PATCH 3/5] tty: n_hdlc: remove HDLC_MAGIC наб
2022-09-16  6:51   ` Jiri Slaby
2022-09-16  1:55 ` [PATCH 4/5] tty: synclink_gt: remove MGSL_MAGIC наб
2022-09-16  6:52   ` Jiri Slaby
2022-09-16  6:51 ` [PATCH 1/5] tty: remove TTY_MAGIC Jiri Slaby
2022-09-16  7:33 ` Theodore Ts'o [this message]
2022-09-16  8:45   ` Jiri Slaby
2022-09-22 14:12 ` Greg Kroah-Hartman

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=YyQm4dBVyvefVcAd@mit.edu \
    --to=tytso@mit.edu \
    --cc=alexs@kernel.org \
    --cc=federico.vaga@vaga.pv.it \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-doc-tw-discuss@lists.sourceforge.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    --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;
as well as URLs for NNTP newsgroup(s).