Linux Hardening
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kees Cook <kees@kernel.org>, Andy Shevchenko <andy@kernel.org>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] string: use min in sized_strscpy
Date: Sun, 17 May 2026 15:14:44 +0100	[thread overview]
Message-ID: <20260517151444.66dc4afb@pumpkin> (raw)
In-Reply-To: <agc3DrODtyc2rF27@linux.dev>

On Fri, 15 May 2026 17:09:02 +0200
Thorsten Blum <thorsten.blum@linux.dev> wrote:

> On Fri, May 15, 2026 at 09:45:08AM +0300, Andy Shevchenko wrote:
.
> How about adding
> 
> #define offset_in_page(p)	((unsigned long)(p) & ~PAGE_MASK)
> #define bytes_to_page_end(p)	(PAGE_SIZE - offset_in_page(p))
> 
> to a new header, e.g. include/linux/page_helpers.h? There are about 50+
> direct replacements and possibly more.
> 

Why not put them in vdso/page.h just after PAGE_MASK.

-- David

  parent reply	other threads:[~2026-05-17 14:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 16:56 [PATCH] string: use min in sized_strscpy Thorsten Blum
2026-05-15  6:45 ` Andy Shevchenko
2026-05-15 15:09   ` Thorsten Blum
2026-05-17  5:56     ` Andy Shevchenko
2026-05-17 14:14     ` David Laight [this message]
2026-05-19 19:37 ` Andrew Morton

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=20260517151444.66dc4afb@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thorsten.blum@linux.dev \
    /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