* [PATCH][next] unicode: fix dereference of a potentially null pointer
@ 2019-04-26 22:22 ` Colin King
0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2019-04-26 22:22 UTC (permalink / raw)
To: Masahiro Yamada, Michal Marek, linux-kbuild; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The pointer 'tree' is deferenced when assigning pointer 'trie', however
trie is being null checked a few lines later, so it could potentially
be null. Fix the potential null pointer dereference by only dereferencing
it after it has been null checked.
Addresses-Coverity: ("Dereference before null check")
Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
scripts/mkutf8data.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/mkutf8data.c b/scripts/mkutf8data.c
index 12ce94b43be6..0563ba679bbb 100644
--- a/scripts/mkutf8data.c
+++ b/scripts/mkutf8data.c
@@ -2706,7 +2706,7 @@ static utf8leaf_t *utf8hangul(const char *str, unsigned char *hangul)
static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
const char *s, size_t len)
{
- utf8trie_t *trie = utf8data + tree->index;
+ utf8trie_t *trie;
int offlen;
int offset;
int mask;
@@ -2716,6 +2716,7 @@ static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
return NULL;
if (len == 0)
return NULL;
+ trie = utf8data + tree->index;
node = 1;
while (node) {
offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH][next] unicode: fix dereference of a potentially null pointer
@ 2019-04-26 22:22 ` Colin King
0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2019-04-26 22:22 UTC (permalink / raw)
To: Masahiro Yamada, Michal Marek, linux-kbuild; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The pointer 'tree' is deferenced when assigning pointer 'trie', however
trie is being null checked a few lines later, so it could potentially
be null. Fix the potential null pointer dereference by only dereferencing
it after it has been null checked.
Addresses-Coverity: ("Dereference before null check")
Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
scripts/mkutf8data.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/mkutf8data.c b/scripts/mkutf8data.c
index 12ce94b43be6..0563ba679bbb 100644
--- a/scripts/mkutf8data.c
+++ b/scripts/mkutf8data.c
@@ -2706,7 +2706,7 @@ static utf8leaf_t *utf8hangul(const char *str, unsigned char *hangul)
static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
const char *s, size_t len)
{
- utf8trie_t *trie = utf8data + tree->index;
+ utf8trie_t *trie;
int offlen;
int offset;
int mask;
@@ -2716,6 +2716,7 @@ static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
return NULL;
if (len = 0)
return NULL;
+ trie = utf8data + tree->index;
node = 1;
while (node) {
offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH][next] unicode: fix dereference of a potentially null pointer
2019-04-26 22:22 ` Colin King
@ 2019-04-27 6:29 ` Masahiro Yamada
-1 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2019-04-27 6:29 UTC (permalink / raw)
To: Olaf Weber, Gabriel Krisman Bertazi, Theodore Ts'o
Cc: Michal Marek, Linux Kbuild mailing list, Colin King,
kernel-janitors, Linux Kernel Mailing List
Forwarding because this file is not in my tree.
On Sat, Apr 27, 2019 at 7:22 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The pointer 'tree' is deferenced when assigning pointer 'trie', however
> trie is being null checked a few lines later, so it could potentially
> be null. Fix the potential null pointer dereference by only dereferencing
> it after it has been null checked.
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> scripts/mkutf8data.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/mkutf8data.c b/scripts/mkutf8data.c
> index 12ce94b43be6..0563ba679bbb 100644
> --- a/scripts/mkutf8data.c
> +++ b/scripts/mkutf8data.c
> @@ -2706,7 +2706,7 @@ static utf8leaf_t *utf8hangul(const char *str, unsigned char *hangul)
> static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
> const char *s, size_t len)
> {
> - utf8trie_t *trie = utf8data + tree->index;
> + utf8trie_t *trie;
> int offlen;
> int offset;
> int mask;
> @@ -2716,6 +2716,7 @@ static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
> return NULL;
> if (len == 0)
> return NULL;
> + trie = utf8data + tree->index;
> node = 1;
> while (node) {
> offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
> --
> 2.20.1
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][next] unicode: fix dereference of a potentially null pointer
@ 2019-04-27 6:29 ` Masahiro Yamada
0 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2019-04-27 6:29 UTC (permalink / raw)
To: Olaf Weber, Gabriel Krisman Bertazi, Theodore Ts'o
Cc: Michal Marek, Linux Kbuild mailing list, Colin King,
kernel-janitors, Linux Kernel Mailing List
Forwarding because this file is not in my tree.
On Sat, Apr 27, 2019 at 7:22 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The pointer 'tree' is deferenced when assigning pointer 'trie', however
> trie is being null checked a few lines later, so it could potentially
> be null. Fix the potential null pointer dereference by only dereferencing
> it after it has been null checked.
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> scripts/mkutf8data.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/mkutf8data.c b/scripts/mkutf8data.c
> index 12ce94b43be6..0563ba679bbb 100644
> --- a/scripts/mkutf8data.c
> +++ b/scripts/mkutf8data.c
> @@ -2706,7 +2706,7 @@ static utf8leaf_t *utf8hangul(const char *str, unsigned char *hangul)
> static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
> const char *s, size_t len)
> {
> - utf8trie_t *trie = utf8data + tree->index;
> + utf8trie_t *trie;
> int offlen;
> int offset;
> int mask;
> @@ -2716,6 +2716,7 @@ static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
> return NULL;
> if (len = 0)
> return NULL;
> + trie = utf8data + tree->index;
> node = 1;
> while (node) {
> offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
> --
> 2.20.1
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][next] unicode: fix dereference of a potentially null pointer
2019-04-27 6:29 ` Masahiro Yamada
@ 2019-04-28 11:02 ` Gabriel Krisman Bertazi
-1 siblings, 0 replies; 8+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-28 11:02 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Olaf Weber, Gabriel Krisman Bertazi, Theodore Ts'o,
Michal Marek, Linux Kbuild mailing list, Colin King,
kernel-janitors, Linux Kernel Mailing List
Masahiro Yamada <yamada.masahiro@socionext.com> writes:
> Forwarding because this file is not in my tree.
>
>
>
>
>
> On Sat, Apr 27, 2019 at 7:22 AM Colin King <colin.king@canonical.com> wrote:
>>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The pointer 'tree' is deferenced when assigning pointer 'trie', however
>> trie is being null checked a few lines later, so it could potentially
>> be null. Fix the potential null pointer dereference by only dereferencing
>> it after it has been null checked.
>>
>> Addresses-Coverity: ("Dereference before null check")
>> Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Ted, can you pick this up directly for now?
>> ---
>> scripts/mkutf8data.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/mkutf8data.c b/scripts/mkutf8data.c
>> index 12ce94b43be6..0563ba679bbb 100644
>> --- a/scripts/mkutf8data.c
>> +++ b/scripts/mkutf8data.c
>> @@ -2706,7 +2706,7 @@ static utf8leaf_t *utf8hangul(const char *str, unsigned char *hangul)
>> static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
>> const char *s, size_t len)
>> {
>> - utf8trie_t *trie = utf8data + tree->index;
>> + utf8trie_t *trie;
>> int offlen;
>> int offset;
>> int mask;
>> @@ -2716,6 +2716,7 @@ static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
>> return NULL;
>> if (len == 0)
>> return NULL;
>> + trie = utf8data + tree->index;
>> node = 1;
>> while (node) {
>> offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
>> --
>> 2.20.1
>>
>
>
> --
> Best Regards
> Masahiro Yamada
--
Gabriel Krisman Bertazi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][next] unicode: fix dereference of a potentially null pointer
@ 2019-04-28 11:02 ` Gabriel Krisman Bertazi
0 siblings, 0 replies; 8+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-28 11:02 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Olaf Weber, Gabriel Krisman Bertazi, Theodore Ts'o,
Michal Marek, Linux Kbuild mailing list, Colin King,
kernel-janitors, Linux Kernel Mailing List
Masahiro Yamada <yamada.masahiro@socionext.com> writes:
> Forwarding because this file is not in my tree.
>
>
>
>
>
> On Sat, Apr 27, 2019 at 7:22 AM Colin King <colin.king@canonical.com> wrote:
>>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The pointer 'tree' is deferenced when assigning pointer 'trie', however
>> trie is being null checked a few lines later, so it could potentially
>> be null. Fix the potential null pointer dereference by only dereferencing
>> it after it has been null checked.
>>
>> Addresses-Coverity: ("Dereference before null check")
>> Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Ted, can you pick this up directly for now?
>> ---
>> scripts/mkutf8data.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/mkutf8data.c b/scripts/mkutf8data.c
>> index 12ce94b43be6..0563ba679bbb 100644
>> --- a/scripts/mkutf8data.c
>> +++ b/scripts/mkutf8data.c
>> @@ -2706,7 +2706,7 @@ static utf8leaf_t *utf8hangul(const char *str, unsigned char *hangul)
>> static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
>> const char *s, size_t len)
>> {
>> - utf8trie_t *trie = utf8data + tree->index;
>> + utf8trie_t *trie;
>> int offlen;
>> int offset;
>> int mask;
>> @@ -2716,6 +2716,7 @@ static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul,
>> return NULL;
>> if (len = 0)
>> return NULL;
>> + trie = utf8data + tree->index;
>> node = 1;
>> while (node) {
>> offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
>> --
>> 2.20.1
>>
>
>
> --
> Best Regards
> Masahiro Yamada
--
Gabriel Krisman Bertazi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][next] unicode: fix dereference of a potentially null pointer
2019-04-28 11:02 ` Gabriel Krisman Bertazi
@ 2019-04-28 13:21 ` Theodore Ts'o
-1 siblings, 0 replies; 8+ messages in thread
From: Theodore Ts'o @ 2019-04-28 13:21 UTC (permalink / raw)
To: Gabriel Krisman Bertazi
Cc: Masahiro Yamada, Olaf Weber, Gabriel Krisman Bertazi,
Michal Marek, Linux Kbuild mailing list, Colin King,
kernel-janitors, Linux Kernel Mailing List
On Sun, Apr 28, 2019 at 07:02:45AM -0400, Gabriel Krisman Bertazi wrote:
> > On Sat, Apr 27, 2019 at 7:22 AM Colin King <colin.king@canonical.com> wrote:
> >>
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> The pointer 'tree' is deferenced when assigning pointer 'trie', however
> >> trie is being null checked a few lines later, so it could potentially
> >> be null. Fix the potential null pointer dereference by only dereferencing
> >> it after it has been null checked.
> >>
> >> Addresses-Coverity: ("Dereference before null check")
> >> Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> Acked-by: Gabriel Krisman Bertazi <krisman@collabora.com>
>
> Ted, can you pick this up directly for now?
Ack, I've merged it into the the patch "unicode: introduce UTF-8
character database".
- Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][next] unicode: fix dereference of a potentially null pointer
@ 2019-04-28 13:21 ` Theodore Ts'o
0 siblings, 0 replies; 8+ messages in thread
From: Theodore Ts'o @ 2019-04-28 13:21 UTC (permalink / raw)
To: Gabriel Krisman Bertazi
Cc: Masahiro Yamada, Olaf Weber, Gabriel Krisman Bertazi,
Michal Marek, Linux Kbuild mailing list, Colin King,
kernel-janitors, Linux Kernel Mailing List
On Sun, Apr 28, 2019 at 07:02:45AM -0400, Gabriel Krisman Bertazi wrote:
> > On Sat, Apr 27, 2019 at 7:22 AM Colin King <colin.king@canonical.com> wrote:
> >>
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> The pointer 'tree' is deferenced when assigning pointer 'trie', however
> >> trie is being null checked a few lines later, so it could potentially
> >> be null. Fix the potential null pointer dereference by only dereferencing
> >> it after it has been null checked.
> >>
> >> Addresses-Coverity: ("Dereference before null check")
> >> Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database")
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> Acked-by: Gabriel Krisman Bertazi <krisman@collabora.com>
>
> Ted, can you pick this up directly for now?
Ack, I've merged it into the the patch "unicode: introduce UTF-8
character database".
- Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-04-28 13:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26 22:22 [PATCH][next] unicode: fix dereference of a potentially null pointer Colin King
2019-04-26 22:22 ` Colin King
2019-04-27 6:29 ` Masahiro Yamada
2019-04-27 6:29 ` Masahiro Yamada
2019-04-28 11:02 ` Gabriel Krisman Bertazi
2019-04-28 11:02 ` Gabriel Krisman Bertazi
2019-04-28 13:21 ` Theodore Ts'o
2019-04-28 13:21 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.