diff options
author | imura <imura@FreeBSD.org> | 2005-09-05 17:03:40 +0000 |
---|---|---|
committer | imura <imura@FreeBSD.org> | 2005-09-05 17:03:40 +0000 |
commit | b03a330dcf6753ba0c13527d536d7b51d4f8f4b8 (patch) | |
tree | f0f07d80b3e52aa1807a3885d1e79cff6fe5eea3 | |
parent | a43b8a5135fa6defd9fd1c455b9bc60db184b3a3 (diff) | |
download | FreeBSD-src-b03a330dcf6753ba0c13527d536d7b51d4f8f4b8.zip FreeBSD-src-b03a330dcf6753ba0c13527d536d7b51d4f8f4b8.tar.gz |
Fix panic when loading libiconv.ko on sparc64.
It seems that this issue only become obvious when compiled with -O2
on sparc64.
Since each struct iconv_converter_class has been initialized by
DEFINE_CLASS macro, not all members of struct iconv_converter_class
has been allocated on memory and cc_link member has not been
initialized, while iconv_register_converter() wanted to access it
with TAILQ.
Now we modify KICONV_CONVERTER macro and fix this bug.
Problem reported on: freebsd-sparc64
Pointed out by: yongari
Discussed with: yongari
Tested by: yongari
MFC after: 3 days
-rw-r--r-- | sys/sys/iconv.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/sys/iconv.h b/sys/sys/iconv.h index 90ea3db..914522d 100644 --- a/sys/sys/iconv.h +++ b/sys/sys/iconv.h @@ -128,8 +128,10 @@ struct iconv_cspair { TAILQ_ENTRY(iconv_cspair) cp_link; }; -#define KICONV_CONVERTER(name,size) \ - static DEFINE_CLASS(iconv_ ## name, iconv_ ## name ## _methods, (size)); \ +#define KICONV_CONVERTER(name,size) \ + static struct iconv_converter_class iconv_ ## name ## _class = { \ + "iconv_"#name, iconv_ ## name ## _methods, size, NULL \ + }; \ static moduledata_t iconv_ ## name ## _mod = { \ "iconv_"#name, iconv_converter_handler, \ (void*)&iconv_ ## name ## _class \ |