Message ID | 1609310713-84972-1-git-send-email-abaci-bugfix@linux.alibaba.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | 9p: fix: Uninitialized variable p. | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
YANG LI wrote on Wed, Dec 30, 2020: > The pointer p is being used but it isn't being initialized, > need to assign a NULL to it. My understanding is p has to be initialized: the only way out of the while(1) loop below sets it. I don't mind fixing false positive warnings as it makes maintenance easier for everyone, but: 1/ the commit message needs to reflect that and at least name which tool had a problem with it. I'm tempted to think this case is common enough that the tool ought to be fixed instead... 2/ the code needs to work in the p=NULL case if you set it that way (right now, it doesn't, so in the event the code changes in the future and there really comes a way to skip initialization this change would actually hinder bug detection -- it'd need to add a p == NULL check below, which is going to be useless code, but hopefully compilers will optimize it away) Thanks,
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 93f2f86..d4d635f 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -342,7 +342,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan, /* kernel buffer, no need to pin pages */ int index; size_t len; - void *p; + void *p = NULL; /* we'd already checked that it's non-empty */ while (1) {
The pointer p is being used but it isn't being initialized, need to assign a NULL to it. Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com> Reported-by: Abaci <abaci@linux.alibaba.com> --- net/9p/trans_virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)