There is no need to have iso8859-1 table defined two times. Fix default
iso8859-1 nls table and remove external iso8859-1 nls definition table.
Signed-off-by: Pali Rohár <[email protected]>
---
fs/nls/Kconfig | 21 ++---
fs/nls/Makefile | 1 -
fs/nls/nls_base.c | 187 +++++++++--------------------------------
fs/nls/nls_iso8859-1.c | 133 -----------------------------
4 files changed, 48 insertions(+), 294 deletions(-)
delete mode 100644 fs/nls/nls_iso8859-1.c
diff --git a/fs/nls/Kconfig b/fs/nls/Kconfig
index c7857e36adbb..8adae2cd5e8b 100644
--- a/fs/nls/Kconfig
+++ b/fs/nls/Kconfig
@@ -32,8 +32,13 @@ config NLS_DEFAULT
iso8859-2, iso8859-3, iso8859-4, iso8859-5, iso8859-6, iso8859-7,
iso8859-8, iso8859-9, iso8859-13, iso8859-14, iso8859-15,
koi8-r, koi8-ru, koi8-u, sjis, tis-620, macroman, utf8.
- If you specify a wrong value, it will use the built-in NLS;
- compatible with iso8859-1.
+ If you specify a wrong value, it will use the built-in NLS iso8859-1.
+
+ ISO 8859-1 (Latin 1; Western European Languages) is a character
+ set, which covers most West European languages such as Albanian,
+ Catalan, Danish, Dutch, English, Faeroese, Finnish, French, German,
+ Galician, Irish, Icelandic, Italian, Norwegian, Portuguese, Spanish,
+ and Swedish. It is also the default for the US.
If unsure, specify it as "iso8859-1".
@@ -316,18 +321,6 @@ config NLS_ASCII
DEFAULT NLS with this very basic charset and don't want any
non-ASCII characters to be translated.
-config NLS_ISO8859_1
- tristate "NLS ISO 8859-1 (Latin 1; Western European Languages)"
- help
- If you want to display filenames with native language characters
- from the Microsoft FAT file system family or from JOLIET CD-ROMs
- correctly on the screen, you need to include the appropriate
- input/output character sets. Say Y here for the Latin 1 character
- set, which covers most West European languages such as Albanian,
- Catalan, Danish, Dutch, English, Faeroese, Finnish, French, German,
- Galician, Irish, Icelandic, Italian, Norwegian, Portuguese, Spanish,
- and Swedish. It is also the default for the US. If unsure, say Y.
-
config NLS_ISO8859_2
tristate "NLS ISO 8859-2 (Latin 2; Slavic/Central European Languages)"
help
diff --git a/fs/nls/Makefile b/fs/nls/Makefile
index ac54db297128..4dede5293131 100644
--- a/fs/nls/Makefile
+++ b/fs/nls/Makefile
@@ -28,7 +28,6 @@ obj-$(CONFIG_NLS_CODEPAGE_950) += nls_cp950.o
obj-$(CONFIG_NLS_CODEPAGE_1250) += nls_cp1250.o
obj-$(CONFIG_NLS_CODEPAGE_1251) += nls_cp1251.o
obj-$(CONFIG_NLS_ASCII) += nls_ascii.o
-obj-$(CONFIG_NLS_ISO8859_1) += nls_iso8859-1.o
obj-$(CONFIG_NLS_ISO8859_2) += nls_iso8859-2.o
obj-$(CONFIG_NLS_ISO8859_3) += nls_iso8859-3.o
obj-$(CONFIG_NLS_ISO8859_4) += nls_iso8859-4.o
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 52ccd34b1e79..5d0e90b50c24 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -299,128 +299,12 @@ void unload_nls(struct nls_table *nls)
module_put(nls->owner);
}
-static const wchar_t charset2uni[256] = {
- /* 0x00*/
- 0x0000, 0x0001, 0x0002, 0x0003,
- 0x0004, 0x0005, 0x0006, 0x0007,
- 0x0008, 0x0009, 0x000a, 0x000b,
- 0x000c, 0x000d, 0x000e, 0x000f,
- /* 0x10*/
- 0x0010, 0x0011, 0x0012, 0x0013,
- 0x0014, 0x0015, 0x0016, 0x0017,
- 0x0018, 0x0019, 0x001a, 0x001b,
- 0x001c, 0x001d, 0x001e, 0x001f,
- /* 0x20*/
- 0x0020, 0x0021, 0x0022, 0x0023,
- 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0028, 0x0029, 0x002a, 0x002b,
- 0x002c, 0x002d, 0x002e, 0x002f,
- /* 0x30*/
- 0x0030, 0x0031, 0x0032, 0x0033,
- 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0x003a, 0x003b,
- 0x003c, 0x003d, 0x003e, 0x003f,
- /* 0x40*/
- 0x0040, 0x0041, 0x0042, 0x0043,
- 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x004a, 0x004b,
- 0x004c, 0x004d, 0x004e, 0x004f,
- /* 0x50*/
- 0x0050, 0x0051, 0x0052, 0x0053,
- 0x0054, 0x0055, 0x0056, 0x0057,
- 0x0058, 0x0059, 0x005a, 0x005b,
- 0x005c, 0x005d, 0x005e, 0x005f,
- /* 0x60*/
- 0x0060, 0x0061, 0x0062, 0x0063,
- 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x006a, 0x006b,
- 0x006c, 0x006d, 0x006e, 0x006f,
- /* 0x70*/
- 0x0070, 0x0071, 0x0072, 0x0073,
- 0x0074, 0x0075, 0x0076, 0x0077,
- 0x0078, 0x0079, 0x007a, 0x007b,
- 0x007c, 0x007d, 0x007e, 0x007f,
- /* 0x80*/
- 0x0080, 0x0081, 0x0082, 0x0083,
- 0x0084, 0x0085, 0x0086, 0x0087,
- 0x0088, 0x0089, 0x008a, 0x008b,
- 0x008c, 0x008d, 0x008e, 0x008f,
- /* 0x90*/
- 0x0090, 0x0091, 0x0092, 0x0093,
- 0x0094, 0x0095, 0x0096, 0x0097,
- 0x0098, 0x0099, 0x009a, 0x009b,
- 0x009c, 0x009d, 0x009e, 0x009f,
- /* 0xa0*/
- 0x00a0, 0x00a1, 0x00a2, 0x00a3,
- 0x00a4, 0x00a5, 0x00a6, 0x00a7,
- 0x00a8, 0x00a9, 0x00aa, 0x00ab,
- 0x00ac, 0x00ad, 0x00ae, 0x00af,
- /* 0xb0*/
- 0x00b0, 0x00b1, 0x00b2, 0x00b3,
- 0x00b4, 0x00b5, 0x00b6, 0x00b7,
- 0x00b8, 0x00b9, 0x00ba, 0x00bb,
- 0x00bc, 0x00bd, 0x00be, 0x00bf,
- /* 0xc0*/
- 0x00c0, 0x00c1, 0x00c2, 0x00c3,
- 0x00c4, 0x00c5, 0x00c6, 0x00c7,
- 0x00c8, 0x00c9, 0x00ca, 0x00cb,
- 0x00cc, 0x00cd, 0x00ce, 0x00cf,
- /* 0xd0*/
- 0x00d0, 0x00d1, 0x00d2, 0x00d3,
- 0x00d4, 0x00d5, 0x00d6, 0x00d7,
- 0x00d8, 0x00d9, 0x00da, 0x00db,
- 0x00dc, 0x00dd, 0x00de, 0x00df,
- /* 0xe0*/
- 0x00e0, 0x00e1, 0x00e2, 0x00e3,
- 0x00e4, 0x00e5, 0x00e6, 0x00e7,
- 0x00e8, 0x00e9, 0x00ea, 0x00eb,
- 0x00ec, 0x00ed, 0x00ee, 0x00ef,
- /* 0xf0*/
- 0x00f0, 0x00f1, 0x00f2, 0x00f3,
- 0x00f4, 0x00f5, 0x00f6, 0x00f7,
- 0x00f8, 0x00f9, 0x00fa, 0x00fb,
- 0x00fc, 0x00fd, 0x00fe, 0x00ff,
-};
-
-static const unsigned char page00[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
-};
-
-static const unsigned char *const page_uni2charset[256] = {
- page00
-};
+/*
+ * Charset iso8859-1 translation tables.
+ * Generated automatically from the Unicode and charset
+ * tables from the Unicode Organization (http://www.unicode.org).
+ * The Unicode to charset table has only exact mappings.
+ */
static const unsigned char charset2lower[256] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
@@ -448,10 +332,10 @@ static const unsigned char charset2lower[256] = {
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
@@ -482,53 +366,51 @@ static const unsigned char charset2upper[256] = {
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xf8-0xff */
};
-
static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
{
- const unsigned char *uni2charset;
- unsigned char cl = uni & 0x00ff;
- unsigned char ch = (uni & 0xff00) >> 8;
-
if (boundlen <= 0)
return -ENAMETOOLONG;
- uni2charset = page_uni2charset[ch];
- if (uni2charset && uni2charset[cl])
- out[0] = uni2charset[cl];
- else
+ if (!uni || uni > 255)
return -EINVAL;
+
+ out[0] = uni;
return 1;
}
static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
{
- *uni = charset2uni[*rawstring];
- if (*uni == 0x0000)
+ if (boundlen <= 0)
+ return -ENAMETOOLONG;
+
+ if (!*rawstring)
return -EINVAL;
+
+ *uni = *rawstring;
return 1;
}
-static struct nls_table default_table = {
- .charset = "default",
+static struct nls_table iso8859_1_table = {
+ .charset = "iso8859-1",
.uni2char = uni2char,
.char2uni = char2uni,
.charset2lower = charset2lower,
.charset2upper = charset2upper,
};
-/* Returns a simple default translation table */
+/* Returns a default translation table */
struct nls_table *load_nls_default(void)
{
struct nls_table *default_nls;
@@ -537,9 +419,22 @@ struct nls_table *load_nls_default(void)
if (default_nls != NULL)
return default_nls;
else
- return &default_table;
+ return &iso8859_1_table;
+}
+
+static int __init init_nls(void)
+{
+ return register_nls(&iso8859_1_table);
}
+static void __exit exit_nls(void)
+{
+ unregister_nls(&iso8859_1_table);
+}
+
+module_init(init_nls)
+module_exit(exit_nls)
+
EXPORT_SYMBOL(unregister_nls);
EXPORT_SYMBOL(unload_nls);
EXPORT_SYMBOL(load_nls);
diff --git a/fs/nls/nls_iso8859-1.c b/fs/nls/nls_iso8859-1.c
deleted file mode 100644
index 17144c17b40c..000000000000
--- a/fs/nls/nls_iso8859-1.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * linux/fs/nls/nls_iso8859-1.c
- *
- * Charset iso8859-1 translation tables.
- * Generated automatically from the Unicode and charset
- * tables from the Unicode Organization (http://www.unicode.org).
- * The Unicode to charset table has only exact mappings.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/nls.h>
-#include <linux/errno.h>
-
-static const unsigned char charset2lower[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
- 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
- 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
-};
-
-static const unsigned char charset2upper[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
- 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
- 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xf8-0xff */
-};
-
-static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
-{
- if (boundlen <= 0)
- return -ENAMETOOLONG;
-
- if (!uni || uni > 255)
- return -EINVAL;
-
- out[0] = uni;
- return 1;
-}
-
-static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
-{
- if (boundlen <= 0)
- return -ENAMETOOLONG;
-
- if (!*rawstring)
- return -EINVAL;
-
- *uni = *rawstring;
- return 1;
-}
-
-static struct nls_table table = {
- .charset = "iso8859-1",
- .uni2char = uni2char,
- .char2uni = char2uni,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
-};
-
-static int __init init_nls_iso8859_1(void)
-{
- return register_nls(&table);
-}
-
-static void __exit exit_nls_iso8859_1(void)
-{
- unregister_nls(&table);
-}
-
-module_init(init_nls_iso8859_1)
-module_exit(exit_nls_iso8859_1)
-
-MODULE_LICENSE("Dual BSD/GPL");
--
2.20.1
Greeting,
FYI, we noticed RIP:strcmp due to commit (built with gcc-11):
commit: 038a8f31f4e69820aa6fd24d8d2f111998939a32 ("[RFC PATCH 3/3] nls: Replace default nls table by correct iso8859-1 table")
url: https://github.com/intel-lab-lkp/linux/commits/Pali-Roh-r/nls-Simplify-ASCII-implementation/20221226-225114
base: https://git.kernel.org/cgit/linux/kernel/git/jack/linux-fs.git for_next
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [RFC PATCH 3/3] nls: Replace default nls table by correct iso8859-1 table
in testcase: xfstests
version: xfstests-x86_64-fb6575e-1_20230102
with following parameters:
disk: 4HDD
fs: ext4
fs2: smbv2
test: generic-group-03
test-description: xfstests is a regression test suite for xfs and other files ystems.
test-url: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
on test machine: 8 threads Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (Skylake) with 16G memory
caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
If you fix the issue, kindly add following tag
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-lkp/[email protected]
[ 88.513573][ T280]
[ 88.531906][ T1438] calling init_dns_resolver+0x0/0x1000 [dns_resolver] @ 1438
[ 88.539223][ T1438] Key type dns_resolver registered
[ 88.544178][ T1438] initcall init_dns_resolver+0x0/0x1000 [dns_resolver] returned 0 after 4968 usecs
[ 88.915310][ T1438] calling init_cifs+0x0/0x1000 [cifs] @ 1438
[ 88.922793][ T1438] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN PTI
[ 88.933987][ T1438] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
[ 88.942226][ T1438] CPU: 5 PID: 1438 Comm: modprobe Tainted: G S 6.1.0-11704-g038a8f31f4e6 #1
[ 88.952115][ T1438] Hardware name: HP HP Z240 SFF Workstation/802E, BIOS N51 Ver. 01.63 10/05/2017
[ 88.961049][ T1438] RIP: 0010:strcmp (kbuild/src/consumer/lib/string.c:281)
[ 88.965481][ T1438] Code: df 41 54 55 53 48 89 fb 48 83 ec 08 eb 08 40 84 ed 74 5d 4c 89 e6 48 89 df 48 83 c3 01 48 89 f8 48 89 fa 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 04 84 c0 75 50 48 89 f0 48 89 f2 0f b6 6b
All code
========
0: df 41 54 filds 0x54(%rcx)
3: 55 push %rbp
4: 53 push %rbx
5: 48 89 fb mov %rdi,%rbx
8: 48 83 ec 08 sub $0x8,%rsp
c: eb 08 jmp 0x16
e: 40 84 ed test %bpl,%bpl
11: 74 5d je 0x70
13: 4c 89 e6 mov %r12,%rsi
16: 48 89 df mov %rbx,%rdi
19: 48 83 c3 01 add $0x1,%rbx
1d: 48 89 f8 mov %rdi,%rax
20: 48 89 fa mov %rdi,%rdx
23: 48 c1 e8 03 shr $0x3,%rax
27: 83 e2 07 and $0x7,%edx
2a:* 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax <-- trapping instruction
2f: 38 d0 cmp %dl,%al
31: 7f 04 jg 0x37
33: 84 c0 test %al,%al
35: 75 50 jne 0x87
37: 48 89 f0 mov %rsi,%rax
3a: 48 89 f2 mov %rsi,%rdx
3d: 0f .byte 0xf
3e: b6 6b mov $0x6b,%dh
Code starting with the faulting instruction
===========================================
0: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax
5: 38 d0 cmp %dl,%al
7: 7f 04 jg 0xd
9: 84 c0 test %al,%al
b: 75 50 jne 0x5d
d: 48 89 f0 mov %rsi,%rax
10: 48 89 f2 mov %rsi,%rdx
13: 0f .byte 0xf
14: b6 6b mov $0x6b,%dh
[ 88.984879][ T1438] RSP: 0018:ffffc90001217a88 EFLAGS: 00010246
[ 88.990781][ T1438] RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff83589fe5
[ 88.998591][ T1438] RDX: 0000000000000000 RSI: ffffffffa2121c00 RDI: 0000000000000000
[ 89.006401][ T1438] RBP: ffffffffa2121c00 R08: 0000000000000001 R09: ffffc90001217a63
[ 89.014209][ T1438] R10: fffff52000242f4c R11: 0000000000000001 R12: ffffffff861052e0
[ 89.022016][ T1438] R13: dffffc0000000000 R14: 0000000000000026 R15: ffffffffa221efc0
[ 89.029829][ T1438] FS: 00007f01fb961540(0000) GS:ffff888366a80000(0000) knlGS:0000000000000000
[ 89.038582][ T1438] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 89.045004][ T1438] CR2: 000056437197c1a8 CR3: 000000013de10001 CR4: 00000000003706e0
[ 89.052812][ T1438] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 89.060623][ T1438] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 89.068430][ T1438] Call Trace:
[ 89.071572][ T1438] <TASK>
[ 89.074365][ T1438] find_nls (kbuild/src/consumer/fs/nls/nls_base.c:280)
[ 89.078284][ T1438] load_nls (kbuild/src/consumer/fs/nls/nls_base.c:293)
[ 89.082114][ T1438] dfs_cache_init (kbuild/src/consumer/fs/cifs/dfs_cache.c:416) cifs
[ 89.087241][ T1438] init_cifs (kbuild/src/consumer/fs/cifs/./trace.h:70 (discriminator 6)) cifs
To reproduce:
git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
sudo bin/lkp install job.yaml # job file is attached in this email
bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
sudo bin/lkp run generated-yaml-file
# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
Pali Roh?r <[email protected]> writes:
[...]
> -static struct nls_table default_table = {
> - .charset = "default",
> +static struct nls_table iso8859_1_table = {
> + .charset = "iso8859-1",
> .uni2char = uni2char,
> .char2uni = char2uni,
> .charset2lower = charset2lower,
> .charset2upper = charset2upper,
> };
iocharset=default was gone with this (user visible) change? (nobody
notice it though)
> -/* Returns a simple default translation table */
> +/* Returns a default translation table */
> struct nls_table *load_nls_default(void)
> {
> struct nls_table *default_nls;
> @@ -537,9 +419,22 @@ struct nls_table *load_nls_default(void)
> if (default_nls != NULL)
> return default_nls;
> else
> - return &default_table;
> + return &iso8859_1_table;
> +}
> +
> +static int __init init_nls(void)
> +{
> + return register_nls(&iso8859_1_table);
> }
>
> +static void __exit exit_nls(void)
> +{
> + unregister_nls(&iso8859_1_table);
> +}
> +
> +module_init(init_nls)
> +module_exit(exit_nls)
[...]
Do we need to merge nls_iso8859-1.c to nls_base.c?
obj-$(CONFIG_NLS) += nls_iso8859-1.o nls_base.o
Something like this (untested), maybe cleaner.
Thanks.
--
OGAWA Hirofumi <[email protected]>
On Tuesday 10 January 2023 18:23:33 OGAWA Hirofumi wrote:
> Pali Rohár <[email protected]> writes:
>
> [...]
>
> > -static struct nls_table default_table = {
> > - .charset = "default",
> > +static struct nls_table iso8859_1_table = {
> > + .charset = "iso8859-1",
> > .uni2char = uni2char,
> > .char2uni = char2uni,
> > .charset2lower = charset2lower,
> > .charset2upper = charset2upper,
> > };
>
> iocharset=default was gone with this (user visible) change? (nobody
> notice it though)
>
> > -/* Returns a simple default translation table */
> > +/* Returns a default translation table */
> > struct nls_table *load_nls_default(void)
> > {
> > struct nls_table *default_nls;
> > @@ -537,9 +419,22 @@ struct nls_table *load_nls_default(void)
> > if (default_nls != NULL)
> > return default_nls;
> > else
> > - return &default_table;
> > + return &iso8859_1_table;
> > +}
> > +
> > +static int __init init_nls(void)
> > +{
> > + return register_nls(&iso8859_1_table);
> > }
> >
> > +static void __exit exit_nls(void)
> > +{
> > + unregister_nls(&iso8859_1_table);
> > +}
> > +
> > +module_init(init_nls)
> > +module_exit(exit_nls)
>
> [...]
>
> Do we need to merge nls_iso8859-1.c to nls_base.c?
>
> obj-$(CONFIG_NLS) += nls_iso8859-1.o nls_base.o
>
> Something like this (untested), maybe cleaner.
>
> Thanks.
> --
> OGAWA Hirofumi <[email protected]>
I will look at it.