public inbox for linux-snps-arc@lists.infradead.org
 help / color / mirror / Atom feed
From: Sergey Matyukevich <geomatsi@gmail.com>
To: linux-snps-arc@lists.infradead.org
Cc: Vineet Gupta <vgupta@kernel.org>,
	Vladimir Isaev <isaev@synopsys.com>,
	Christoph Hellwig <hch@lst.de>,
	Sergey Matyukevich <geomatsi@gmail.com>,
	Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Subject: [RFC PATCH 1/3] arc: use BUILD_BUG for invalid sizes in get_user/put_user
Date: Tue,  1 Feb 2022 17:55:36 +0300	[thread overview]
Message-ID: <20220201145538.111192-2-geomatsi@gmail.com> (raw)
In-Reply-To: <20220201145538.111192-1-geomatsi@gmail.com>

From: Sergey Matyukevich <sergey.matyukevich@synopsys.com>

Use BUILD_BUG for compile-time check of invalid sizes passed
to get_user/put_user functions.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
---
 arch/arc/include/asm/uaccess.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
index 783bfdb3bfa3..9d1205bf90f1 100644
--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -62,6 +62,7 @@
 	case 2: __arc_get_user_one(*(k), u, "ldw", __ret); break;	\
 	case 4: __arc_get_user_one(*(k), u, "ld", __ret);  break;	\
 	case 8: __arc_get_user_one_64(*(k), u, __ret);     break;	\
+	default: BUILD_BUG();                                   \
 	}							\
 	__ret;							\
 })
@@ -123,6 +124,7 @@
 	case 2: __arc_put_user_one(*(k), u, "stw", __ret); break;	\
 	case 4: __arc_put_user_one(*(k), u, "st", __ret);  break;	\
 	case 8: __arc_put_user_one_64(*(k), u, __ret);     break;	\
+	default: BUILD_BUG();                                   \
 	}							\
 	__ret;							\
 })
-- 
2.35.0


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

  reply	other threads:[~2022-02-01 14:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 14:55 [RFC PATCH 0/3] arc: remove CONFIG_SET_FS Sergey Matyukevich
2022-02-01 14:55 ` Sergey Matyukevich [this message]
2022-02-01 15:08   ` [RFC PATCH 1/3] arc: use BUILD_BUG for invalid sizes in get_user/put_user Christoph Hellwig
2022-02-01 14:55 ` [RFC PATCH 2/3] arc: provide __{get,put}_kernel_nofault Sergey Matyukevich
2022-02-01 15:10   ` Christoph Hellwig
2022-02-01 14:55 ` [RFC PATCH 3/3] arc: remove set_fs() Sergey Matyukevich
2022-02-01 15:11   ` Christoph Hellwig
2022-02-02  5:14 ` [RFC PATCH 0/3] arc: remove CONFIG_SET_FS Vineet Gupta
2022-02-15 21:04   ` Sergey Matyukevich
2022-02-18  4:03     ` Vineet Gupta

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=20220201145538.111192-2-geomatsi@gmail.com \
    --to=geomatsi@gmail.com \
    --cc=hch@lst.de \
    --cc=isaev@synopsys.com \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=sergey.matyukevich@synopsys.com \
    --cc=vgupta@kernel.org \
    /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