Skip to content

Commit 43bf9d9

Browse files
t-8chkrisman
authored andcommitted
unicode: constify utf8 data table
All users already handle the table as const data. Move the table itself into .rodata to guard against accidental or malicious modifications. Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gabriel Krisman Bertazi <[email protected]>
1 parent 17712b7 commit 43bf9d9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

fs/unicode/mkutf8data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3338,7 +3338,7 @@ static void write_file(void)
33383338
}
33393339
fprintf(file, "};\n");
33403340
fprintf(file, "\n");
3341-
fprintf(file, "struct utf8data_table utf8_data_table = {\n");
3341+
fprintf(file, "const struct utf8data_table utf8_data_table = {\n");
33423342
fprintf(file, "\t.utf8agetab = utf8agetab,\n");
33433343
fprintf(file, "\t.utf8agetab_size = ARRAY_SIZE(utf8agetab),\n");
33443344
fprintf(file, "\n");

fs/unicode/utf8data.c_shipped

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4107,7 +4107,7 @@ static const unsigned char utf8data[64256] = {
41074107
0x81,0x80,0xcf,0x86,0x85,0x84,0xcf,0x86,0xcf,0x06,0x02,0x00,0x00,0x00,0x00,0x00
41084108
};
41094109

4110-
struct utf8data_table utf8_data_table = {
4110+
const struct utf8data_table utf8_data_table = {
41114111
.utf8agetab = utf8agetab,
41124112
.utf8agetab_size = ARRAY_SIZE(utf8agetab),
41134113

fs/unicode/utf8n.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ struct utf8data_table {
7878
const unsigned char *utf8data;
7979
};
8080

81-
extern struct utf8data_table utf8_data_table;
81+
extern const struct utf8data_table utf8_data_table;
8282

8383
#endif /* UTF8NORM_H */

0 commit comments

Comments
 (0)