* [lee-linaro:tb-fix-w1-warnings 125/232] drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:135 sideband_msg_req_encode_decode() warn: possible memory leak of 'out'
@ 2020-11-11 10:06 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-11-11 10:06 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4892 bytes --]
tree: https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head: e825caa1d43573f0c17dded446f806064e767e81
commit: 81b681e9f500df49c7b4f7bdea35692ae362701a [125/232] drm/selftests/test-drm_dp_mst_helper: Move 'sideband_msg_req_encode_decode' onto the heap
config: i386-randconfig-m021-20201111 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:135 sideband_msg_req_encode_decode() warn: possible memory leak of 'out'
vim +/out +135 drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
2f015ec6eab6930 Lyude Paul 2019-09-03 120 static bool
2f015ec6eab6930 Lyude Paul 2019-09-03 121 sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)
2f015ec6eab6930 Lyude Paul 2019-09-03 122 {
fc6e9f1a18159e5 Lee Jones 2020-11-05 123 struct drm_dp_sideband_msg_req_body *out;
2f015ec6eab6930 Lyude Paul 2019-09-03 124 struct drm_printer p = drm_err_printer(PREFIX_STR);
81b681e9f500df4 Lee Jones 2020-11-05 125 struct drm_dp_sideband_msg_tx *txmsg;
2f015ec6eab6930 Lyude Paul 2019-09-03 126 int i, ret;
fc6e9f1a18159e5 Lee Jones 2020-11-05 127 bool result = true;
fc6e9f1a18159e5 Lee Jones 2020-11-05 128
fc6e9f1a18159e5 Lee Jones 2020-11-05 129 out = kzalloc(sizeof(*out), GFP_KERNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fc6e9f1a18159e5 Lee Jones 2020-11-05 130 if (!out)
fc6e9f1a18159e5 Lee Jones 2020-11-05 131 return false;
2f015ec6eab6930 Lyude Paul 2019-09-03 132
81b681e9f500df4 Lee Jones 2020-11-05 133 txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
81b681e9f500df4 Lee Jones 2020-11-05 134 if (!txmsg)
81b681e9f500df4 Lee Jones 2020-11-05 @135 return false;
^^^^^^^^^^^^^
Leak
81b681e9f500df4 Lee Jones 2020-11-05 136
81b681e9f500df4 Lee Jones 2020-11-05 137 drm_dp_encode_sideband_req(in, txmsg);
81b681e9f500df4 Lee Jones 2020-11-05 138 ret = drm_dp_decode_sideband_req(txmsg, out);
2f015ec6eab6930 Lyude Paul 2019-09-03 139 if (ret < 0) {
2f015ec6eab6930 Lyude Paul 2019-09-03 140 drm_printf(&p, "Failed to decode sideband request: %d\n",
2f015ec6eab6930 Lyude Paul 2019-09-03 141 ret);
fc6e9f1a18159e5 Lee Jones 2020-11-05 142 result = false;
fc6e9f1a18159e5 Lee Jones 2020-11-05 143 goto out;
2f015ec6eab6930 Lyude Paul 2019-09-03 144 }
2f015ec6eab6930 Lyude Paul 2019-09-03 145
fc6e9f1a18159e5 Lee Jones 2020-11-05 146 if (!sideband_msg_req_equal(in, out)) {
2f015ec6eab6930 Lyude Paul 2019-09-03 147 drm_printf(&p, "Encode/decode failed, expected:\n");
2f015ec6eab6930 Lyude Paul 2019-09-03 148 drm_dp_dump_sideband_msg_req_body(in, 1, &p);
2f015ec6eab6930 Lyude Paul 2019-09-03 149 drm_printf(&p, "Got:\n");
fc6e9f1a18159e5 Lee Jones 2020-11-05 150 drm_dp_dump_sideband_msg_req_body(out, 1, &p);
fc6e9f1a18159e5 Lee Jones 2020-11-05 151 result = false;
fc6e9f1a18159e5 Lee Jones 2020-11-05 152 goto out;
2f015ec6eab6930 Lyude Paul 2019-09-03 153 }
2f015ec6eab6930 Lyude Paul 2019-09-03 154
2f015ec6eab6930 Lyude Paul 2019-09-03 155 switch (in->req_type) {
2f015ec6eab6930 Lyude Paul 2019-09-03 156 case DP_REMOTE_DPCD_WRITE:
fc6e9f1a18159e5 Lee Jones 2020-11-05 157 kfree(out->u.dpcd_write.bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 158 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 159 case DP_REMOTE_I2C_READ:
fc6e9f1a18159e5 Lee Jones 2020-11-05 160 for (i = 0; i < out->u.i2c_read.num_transactions; i++)
fc6e9f1a18159e5 Lee Jones 2020-11-05 161 kfree(out->u.i2c_read.transactions[i].bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 162 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 163 case DP_REMOTE_I2C_WRITE:
fc6e9f1a18159e5 Lee Jones 2020-11-05 164 kfree(out->u.i2c_write.bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 165 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 166 }
2f015ec6eab6930 Lyude Paul 2019-09-03 167
2f015ec6eab6930 Lyude Paul 2019-09-03 168 /* Clear everything but the req_type for the input */
2f015ec6eab6930 Lyude Paul 2019-09-03 169 memset(&in->u, 0, sizeof(in->u));
2f015ec6eab6930 Lyude Paul 2019-09-03 170
fc6e9f1a18159e5 Lee Jones 2020-11-05 171 out:
fc6e9f1a18159e5 Lee Jones 2020-11-05 172 kfree(out);
81b681e9f500df4 Lee Jones 2020-11-05 173 kfree(txmsg);
fc6e9f1a18159e5 Lee Jones 2020-11-05 174 return result;
2f015ec6eab6930 Lyude Paul 2019-09-03 175 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35092 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [lee-linaro:tb-fix-w1-warnings 125/232] drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:135 sideband_msg_req_encode_decode() warn: possible memory leak of 'out'
@ 2020-11-11 10:06 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-11-11 10:06 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4892 bytes --]
tree: https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head: e825caa1d43573f0c17dded446f806064e767e81
commit: 81b681e9f500df49c7b4f7bdea35692ae362701a [125/232] drm/selftests/test-drm_dp_mst_helper: Move 'sideband_msg_req_encode_decode' onto the heap
config: i386-randconfig-m021-20201111 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:135 sideband_msg_req_encode_decode() warn: possible memory leak of 'out'
vim +/out +135 drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
2f015ec6eab6930 Lyude Paul 2019-09-03 120 static bool
2f015ec6eab6930 Lyude Paul 2019-09-03 121 sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)
2f015ec6eab6930 Lyude Paul 2019-09-03 122 {
fc6e9f1a18159e5 Lee Jones 2020-11-05 123 struct drm_dp_sideband_msg_req_body *out;
2f015ec6eab6930 Lyude Paul 2019-09-03 124 struct drm_printer p = drm_err_printer(PREFIX_STR);
81b681e9f500df4 Lee Jones 2020-11-05 125 struct drm_dp_sideband_msg_tx *txmsg;
2f015ec6eab6930 Lyude Paul 2019-09-03 126 int i, ret;
fc6e9f1a18159e5 Lee Jones 2020-11-05 127 bool result = true;
fc6e9f1a18159e5 Lee Jones 2020-11-05 128
fc6e9f1a18159e5 Lee Jones 2020-11-05 129 out = kzalloc(sizeof(*out), GFP_KERNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fc6e9f1a18159e5 Lee Jones 2020-11-05 130 if (!out)
fc6e9f1a18159e5 Lee Jones 2020-11-05 131 return false;
2f015ec6eab6930 Lyude Paul 2019-09-03 132
81b681e9f500df4 Lee Jones 2020-11-05 133 txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
81b681e9f500df4 Lee Jones 2020-11-05 134 if (!txmsg)
81b681e9f500df4 Lee Jones 2020-11-05 @135 return false;
^^^^^^^^^^^^^
Leak
81b681e9f500df4 Lee Jones 2020-11-05 136
81b681e9f500df4 Lee Jones 2020-11-05 137 drm_dp_encode_sideband_req(in, txmsg);
81b681e9f500df4 Lee Jones 2020-11-05 138 ret = drm_dp_decode_sideband_req(txmsg, out);
2f015ec6eab6930 Lyude Paul 2019-09-03 139 if (ret < 0) {
2f015ec6eab6930 Lyude Paul 2019-09-03 140 drm_printf(&p, "Failed to decode sideband request: %d\n",
2f015ec6eab6930 Lyude Paul 2019-09-03 141 ret);
fc6e9f1a18159e5 Lee Jones 2020-11-05 142 result = false;
fc6e9f1a18159e5 Lee Jones 2020-11-05 143 goto out;
2f015ec6eab6930 Lyude Paul 2019-09-03 144 }
2f015ec6eab6930 Lyude Paul 2019-09-03 145
fc6e9f1a18159e5 Lee Jones 2020-11-05 146 if (!sideband_msg_req_equal(in, out)) {
2f015ec6eab6930 Lyude Paul 2019-09-03 147 drm_printf(&p, "Encode/decode failed, expected:\n");
2f015ec6eab6930 Lyude Paul 2019-09-03 148 drm_dp_dump_sideband_msg_req_body(in, 1, &p);
2f015ec6eab6930 Lyude Paul 2019-09-03 149 drm_printf(&p, "Got:\n");
fc6e9f1a18159e5 Lee Jones 2020-11-05 150 drm_dp_dump_sideband_msg_req_body(out, 1, &p);
fc6e9f1a18159e5 Lee Jones 2020-11-05 151 result = false;
fc6e9f1a18159e5 Lee Jones 2020-11-05 152 goto out;
2f015ec6eab6930 Lyude Paul 2019-09-03 153 }
2f015ec6eab6930 Lyude Paul 2019-09-03 154
2f015ec6eab6930 Lyude Paul 2019-09-03 155 switch (in->req_type) {
2f015ec6eab6930 Lyude Paul 2019-09-03 156 case DP_REMOTE_DPCD_WRITE:
fc6e9f1a18159e5 Lee Jones 2020-11-05 157 kfree(out->u.dpcd_write.bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 158 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 159 case DP_REMOTE_I2C_READ:
fc6e9f1a18159e5 Lee Jones 2020-11-05 160 for (i = 0; i < out->u.i2c_read.num_transactions; i++)
fc6e9f1a18159e5 Lee Jones 2020-11-05 161 kfree(out->u.i2c_read.transactions[i].bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 162 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 163 case DP_REMOTE_I2C_WRITE:
fc6e9f1a18159e5 Lee Jones 2020-11-05 164 kfree(out->u.i2c_write.bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 165 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 166 }
2f015ec6eab6930 Lyude Paul 2019-09-03 167
2f015ec6eab6930 Lyude Paul 2019-09-03 168 /* Clear everything but the req_type for the input */
2f015ec6eab6930 Lyude Paul 2019-09-03 169 memset(&in->u, 0, sizeof(in->u));
2f015ec6eab6930 Lyude Paul 2019-09-03 170
fc6e9f1a18159e5 Lee Jones 2020-11-05 171 out:
fc6e9f1a18159e5 Lee Jones 2020-11-05 172 kfree(out);
81b681e9f500df4 Lee Jones 2020-11-05 173 kfree(txmsg);
fc6e9f1a18159e5 Lee Jones 2020-11-05 174 return result;
2f015ec6eab6930 Lyude Paul 2019-09-03 175 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35092 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [lee-linaro:tb-fix-w1-warnings 125/232] drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:135 sideband_msg_req_encode_decode() warn: possible memory leak of 'out'
@ 2020-11-11 7:05 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-11-11 7:05 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4953 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Lee Jones <lee.jones@linaro.org>
tree: https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head: e825caa1d43573f0c17dded446f806064e767e81
commit: 81b681e9f500df49c7b4f7bdea35692ae362701a [125/232] drm/selftests/test-drm_dp_mst_helper: Move 'sideband_msg_req_encode_decode' onto the heap
:::::: branch date: 15 hours ago
:::::: commit date: 21 hours ago
config: i386-randconfig-m021-20201111 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:135 sideband_msg_req_encode_decode() warn: possible memory leak of 'out'
vim +/out +135 drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
2f015ec6eab6930 Lyude Paul 2019-09-03 119
2f015ec6eab6930 Lyude Paul 2019-09-03 120 static bool
2f015ec6eab6930 Lyude Paul 2019-09-03 121 sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)
2f015ec6eab6930 Lyude Paul 2019-09-03 122 {
fc6e9f1a18159e5 Lee Jones 2020-11-05 123 struct drm_dp_sideband_msg_req_body *out;
2f015ec6eab6930 Lyude Paul 2019-09-03 124 struct drm_printer p = drm_err_printer(PREFIX_STR);
81b681e9f500df4 Lee Jones 2020-11-05 125 struct drm_dp_sideband_msg_tx *txmsg;
2f015ec6eab6930 Lyude Paul 2019-09-03 126 int i, ret;
fc6e9f1a18159e5 Lee Jones 2020-11-05 127 bool result = true;
fc6e9f1a18159e5 Lee Jones 2020-11-05 128
fc6e9f1a18159e5 Lee Jones 2020-11-05 129 out = kzalloc(sizeof(*out), GFP_KERNEL);
fc6e9f1a18159e5 Lee Jones 2020-11-05 130 if (!out)
fc6e9f1a18159e5 Lee Jones 2020-11-05 131 return false;
2f015ec6eab6930 Lyude Paul 2019-09-03 132
81b681e9f500df4 Lee Jones 2020-11-05 133 txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
81b681e9f500df4 Lee Jones 2020-11-05 134 if (!txmsg)
81b681e9f500df4 Lee Jones 2020-11-05 @135 return false;
81b681e9f500df4 Lee Jones 2020-11-05 136
81b681e9f500df4 Lee Jones 2020-11-05 137 drm_dp_encode_sideband_req(in, txmsg);
81b681e9f500df4 Lee Jones 2020-11-05 138 ret = drm_dp_decode_sideband_req(txmsg, out);
2f015ec6eab6930 Lyude Paul 2019-09-03 139 if (ret < 0) {
2f015ec6eab6930 Lyude Paul 2019-09-03 140 drm_printf(&p, "Failed to decode sideband request: %d\n",
2f015ec6eab6930 Lyude Paul 2019-09-03 141 ret);
fc6e9f1a18159e5 Lee Jones 2020-11-05 142 result = false;
fc6e9f1a18159e5 Lee Jones 2020-11-05 143 goto out;
2f015ec6eab6930 Lyude Paul 2019-09-03 144 }
2f015ec6eab6930 Lyude Paul 2019-09-03 145
fc6e9f1a18159e5 Lee Jones 2020-11-05 146 if (!sideband_msg_req_equal(in, out)) {
2f015ec6eab6930 Lyude Paul 2019-09-03 147 drm_printf(&p, "Encode/decode failed, expected:\n");
2f015ec6eab6930 Lyude Paul 2019-09-03 148 drm_dp_dump_sideband_msg_req_body(in, 1, &p);
2f015ec6eab6930 Lyude Paul 2019-09-03 149 drm_printf(&p, "Got:\n");
fc6e9f1a18159e5 Lee Jones 2020-11-05 150 drm_dp_dump_sideband_msg_req_body(out, 1, &p);
fc6e9f1a18159e5 Lee Jones 2020-11-05 151 result = false;
fc6e9f1a18159e5 Lee Jones 2020-11-05 152 goto out;
2f015ec6eab6930 Lyude Paul 2019-09-03 153 }
2f015ec6eab6930 Lyude Paul 2019-09-03 154
2f015ec6eab6930 Lyude Paul 2019-09-03 155 switch (in->req_type) {
2f015ec6eab6930 Lyude Paul 2019-09-03 156 case DP_REMOTE_DPCD_WRITE:
fc6e9f1a18159e5 Lee Jones 2020-11-05 157 kfree(out->u.dpcd_write.bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 158 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 159 case DP_REMOTE_I2C_READ:
fc6e9f1a18159e5 Lee Jones 2020-11-05 160 for (i = 0; i < out->u.i2c_read.num_transactions; i++)
fc6e9f1a18159e5 Lee Jones 2020-11-05 161 kfree(out->u.i2c_read.transactions[i].bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 162 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 163 case DP_REMOTE_I2C_WRITE:
fc6e9f1a18159e5 Lee Jones 2020-11-05 164 kfree(out->u.i2c_write.bytes);
2f015ec6eab6930 Lyude Paul 2019-09-03 165 break;
2f015ec6eab6930 Lyude Paul 2019-09-03 166 }
2f015ec6eab6930 Lyude Paul 2019-09-03 167
2f015ec6eab6930 Lyude Paul 2019-09-03 168 /* Clear everything but the req_type for the input */
2f015ec6eab6930 Lyude Paul 2019-09-03 169 memset(&in->u, 0, sizeof(in->u));
2f015ec6eab6930 Lyude Paul 2019-09-03 170
fc6e9f1a18159e5 Lee Jones 2020-11-05 171 out:
fc6e9f1a18159e5 Lee Jones 2020-11-05 172 kfree(out);
81b681e9f500df4 Lee Jones 2020-11-05 173 kfree(txmsg);
fc6e9f1a18159e5 Lee Jones 2020-11-05 174 return result;
2f015ec6eab6930 Lyude Paul 2019-09-03 175 }
2f015ec6eab6930 Lyude Paul 2019-09-03 176
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35092 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-11 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 10:06 [lee-linaro:tb-fix-w1-warnings 125/232] drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:135 sideband_msg_req_encode_decode() warn: possible memory leak of 'out' Dan Carpenter
2020-11-11 10:06 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-11-11 7:05 kernel test robot
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.