From: scan-admin@coverity.com
To: ceph-devel@vger.kernel.org
Subject: New Defects reported by Coverity Scan for ceph
Date: Fri, 14 Nov 2014 06:21:50 -0800 [thread overview]
Message-ID: <54660ffe93e48_254aa9733843444@scan.coverity.com.mail> (raw)
Hi,
Please find the latest report on new defect(s) introduced to ceph found with Coverity Scan.
8 new defect(s) introduced to ceph found with Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 8 of 8 defect(s)
** CID 1254376: Resource leak (RESOURCE_LEAK)
/test/msgr/test_async_driver.cc: 212 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 219 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 220 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 230 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 231 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 227 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 233 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 210 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
** CID 1254374: Argument cannot be negative (NEGATIVE_RETURNS)
/test/msgr/test_async_driver.cc: 147 in echoclient(void *)()
** CID 1254375: Resource leak (RESOURCE_LEAK)
/test/msgr/test_async_driver.cc: 169 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 166 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 171 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 185 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 187 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 194 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 196 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 201 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 205 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 206 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 210 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 212 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 219 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 220 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 227 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 230 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 231 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
/test/msgr/test_async_driver.cc: 233 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
** CID 1254380: Uninitialized scalar variable (UNINIT)
/test/msgr/test_async_driver.cc: 147 in echoclient(void *)()
** CID 1254379: Uninitialized scalar variable (UNINIT)
/test/msgr/test_async_driver.cc: 116 in EventDriverTest_PipeTest_Test::TestBody()()
** CID 1254381: Uninitialized scalar field (UNINIT_CTOR)
/msg/async/EventSelect.h: 34 in SelectDriver::SelectDriver(CephContext *)()
** CID 1254377: String not null terminated (STRING_NULL)
/test/msgr/test_async_driver.cc: 232 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
** CID 1254378: Uncaught exception (UNCAUGHT_EXCEPT)
/test/msgr/test_async_driver.cc: 269 in main()
/test/msgr/test_async_driver.cc: 269 in main()
________________________________________________________________________________________________________
*** CID 1254376: Resource leak (RESOURCE_LEAK)
/test/msgr/test_async_driver.cc: 212 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
206 ASSERT_EQ(fired_events[0].fd, listen_sd);
207
208 fired_events.clear();
209 int client_sd = ::accept(listen_sd, NULL, NULL);
210 ASSERT_TRUE(client_sd > 0);
211 r = driver->add_event(client_sd, EVENT_NONE, EVENT_READABLE);
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
212 ASSERT_EQ(r, 0);
213
214 do {
215 fired_events.clear();
216 tv.tv_sec = 5;
217 tv.tv_usec = 0;
/test/msgr/test_async_driver.cc: 219 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
213
214 do {
215 fired_events.clear();
216 tv.tv_sec = 5;
217 tv.tv_usec = 0;
218 r = driver->event_wait(fired_events, &tv);
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
219 ASSERT_EQ(r, 1);
220 ASSERT_EQ(fired_events[0].mask, EVENT_READABLE);
221
222 fired_events.clear();
223 char data[100];
224 r = ::read(client_sd, data, sizeof(data));
/test/msgr/test_async_driver.cc: 220 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
214 do {
215 fired_events.clear();
216 tv.tv_sec = 5;
217 tv.tv_usec = 0;
218 r = driver->event_wait(fired_events, &tv);
219 ASSERT_EQ(r, 1);
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
220 ASSERT_EQ(fired_events[0].mask, EVENT_READABLE);
221
222 fired_events.clear();
223 char data[100];
224 r = ::read(client_sd, data, sizeof(data));
225 if (r == 0)
/test/msgr/test_async_driver.cc: 230 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
224 r = ::read(client_sd, data, sizeof(data));
225 if (r == 0)
226 break;
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
230 ASSERT_EQ(r, 1);
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
233 ASSERT_EQ(r, strlen(data));
234 driver->del_event(client_sd, EVENT_READABLE|EVENT_WRITABLE,
235 EVENT_WRITABLE);
/test/msgr/test_async_driver.cc: 231 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
225 if (r == 0)
226 break;
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
230 ASSERT_EQ(r, 1);
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
233 ASSERT_EQ(r, strlen(data));
234 driver->del_event(client_sd, EVENT_READABLE|EVENT_WRITABLE,
235 EVENT_WRITABLE);
236 } while (1);
/test/msgr/test_async_driver.cc: 227 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
221
222 fired_events.clear();
223 char data[100];
224 r = ::read(client_sd, data, sizeof(data));
225 if (r == 0)
226 break;
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
230 ASSERT_EQ(r, 1);
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
/test/msgr/test_async_driver.cc: 233 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
230 ASSERT_EQ(r, 1);
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
233 ASSERT_EQ(r, strlen(data));
234 driver->del_event(client_sd, EVENT_READABLE|EVENT_WRITABLE,
235 EVENT_WRITABLE);
236 } while (1);
237
238 ::close(client_sd);
/test/msgr/test_async_driver.cc: 210 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
204 r = driver->event_wait(fired_events, &tv);
205 ASSERT_EQ(r, 1);
206 ASSERT_EQ(fired_events[0].fd, listen_sd);
207
208 fired_events.clear();
209 int client_sd = ::accept(listen_sd, NULL, NULL);
>>> CID 1254376: Resource leak (RESOURCE_LEAK)
>>> Handle variable "client_sd" going out of scope leaks the handle.
210 ASSERT_TRUE(client_sd > 0);
211 r = driver->add_event(client_sd, EVENT_NONE, EVENT_READABLE);
212 ASSERT_EQ(r, 0);
213
214 do {
215 fired_events.clear();
________________________________________________________________________________________________________
*** CID 1254374: Argument cannot be negative (NEGATIVE_RETURNS)
/test/msgr/test_async_driver.cc: 147 in echoclient(void *)()
141 int connect_sd = ::socket(AF_INET, SOCK_STREAM, 0);
142 struct sockaddr_in sa;
143 sa.sin_family = AF_INET;
144 sa.sin_port = htons(port);
145 char addr[] = "127.0.0.1";
146 int r = inet_aton(addr, &sa.sin_addr);
>>> CID 1254374: Argument cannot be negative (NEGATIVE_RETURNS)
>>> "connect_sd" is passed to a parameter that cannot be negative.
147 r = connect(connect_sd, (struct sockaddr*)&sa, sizeof(sa));
148 int t = 0;
149
150 do {
151 char c[] = "banner";
152 r = write(connect_sd, c, sizeof(c));
________________________________________________________________________________________________________
*** CID 1254375: Resource leak (RESOURCE_LEAK)
/test/msgr/test_async_driver.cc: 169 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
163
164 TEST_P(EventDriverTest, NetworkSocketTest) {
165 int listen_sd = ::socket(AF_INET, SOCK_STREAM, 0);
166 ASSERT_TRUE(listen_sd > 0);
167 int on = 1;
168 int r = ::setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
169 ASSERT_EQ(r, 0);
170 r = set_nonblock(listen_sd);
171 ASSERT_EQ(r, 0);
172 struct sockaddr_in sa;
173 int port = 0;
174 for (port = 38788; port < 40000; port++) {
/test/msgr/test_async_driver.cc: 166 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
160 ::close(connect_sd);
161 return 0;
162 }
163
164 TEST_P(EventDriverTest, NetworkSocketTest) {
165 int listen_sd = ::socket(AF_INET, SOCK_STREAM, 0);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
166 ASSERT_TRUE(listen_sd > 0);
167 int on = 1;
168 int r = ::setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
169 ASSERT_EQ(r, 0);
170 r = set_nonblock(listen_sd);
171 ASSERT_EQ(r, 0);
/test/msgr/test_async_driver.cc: 171 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
165 int listen_sd = ::socket(AF_INET, SOCK_STREAM, 0);
166 ASSERT_TRUE(listen_sd > 0);
167 int on = 1;
168 int r = ::setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
169 ASSERT_EQ(r, 0);
170 r = set_nonblock(listen_sd);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
171 ASSERT_EQ(r, 0);
172 struct sockaddr_in sa;
173 int port = 0;
174 for (port = 38788; port < 40000; port++) {
175 memset(&sa,0,sizeof(sa));
176 sa.sin_family = AF_INET;
/test/msgr/test_async_driver.cc: 185 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
179
180 r = ::bind(listen_sd, (struct sockaddr *)&sa, sizeof(sa));
181 if (r == 0) {
182 break;
183 }
184 }
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
185 ASSERT_EQ(r, 0);
186 r = listen(listen_sd, 511);
187 ASSERT_EQ(r, 0);
188
189 vector<FiredFileEvent> fired_events;
190 struct timeval tv;
/test/msgr/test_async_driver.cc: 187 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
181 if (r == 0) {
182 break;
183 }
184 }
185 ASSERT_EQ(r, 0);
186 r = listen(listen_sd, 511);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
187 ASSERT_EQ(r, 0);
188
189 vector<FiredFileEvent> fired_events;
190 struct timeval tv;
191 tv.tv_sec = 0;
192 tv.tv_usec = 1;
/test/msgr/test_async_driver.cc: 194 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
188
189 vector<FiredFileEvent> fired_events;
190 struct timeval tv;
191 tv.tv_sec = 0;
192 tv.tv_usec = 1;
193 r = driver->add_event(listen_sd, EVENT_NONE, EVENT_READABLE);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
194 ASSERT_EQ(r, 0);
195 r = driver->event_wait(fired_events, &tv);
196 ASSERT_EQ(r, 0);
197
198 fired_events.clear();
199 pthread_t thread1;
/test/msgr/test_async_driver.cc: 196 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
190 struct timeval tv;
191 tv.tv_sec = 0;
192 tv.tv_usec = 1;
193 r = driver->add_event(listen_sd, EVENT_NONE, EVENT_READABLE);
194 ASSERT_EQ(r, 0);
195 r = driver->event_wait(fired_events, &tv);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
196 ASSERT_EQ(r, 0);
197
198 fired_events.clear();
199 pthread_t thread1;
200 r = pthread_create(&thread1, NULL, echoclient, (void*)port);
201 ASSERT_EQ(r, 0);
/test/msgr/test_async_driver.cc: 201 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
195 r = driver->event_wait(fired_events, &tv);
196 ASSERT_EQ(r, 0);
197
198 fired_events.clear();
199 pthread_t thread1;
200 r = pthread_create(&thread1, NULL, echoclient, (void*)port);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
201 ASSERT_EQ(r, 0);
202 tv.tv_sec = 5;
203 tv.tv_usec = 0;
204 r = driver->event_wait(fired_events, &tv);
205 ASSERT_EQ(r, 1);
206 ASSERT_EQ(fired_events[0].fd, listen_sd);
/test/msgr/test_async_driver.cc: 205 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
199 pthread_t thread1;
200 r = pthread_create(&thread1, NULL, echoclient, (void*)port);
201 ASSERT_EQ(r, 0);
202 tv.tv_sec = 5;
203 tv.tv_usec = 0;
204 r = driver->event_wait(fired_events, &tv);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
205 ASSERT_EQ(r, 1);
206 ASSERT_EQ(fired_events[0].fd, listen_sd);
207
208 fired_events.clear();
209 int client_sd = ::accept(listen_sd, NULL, NULL);
210 ASSERT_TRUE(client_sd > 0);
/test/msgr/test_async_driver.cc: 206 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
200 r = pthread_create(&thread1, NULL, echoclient, (void*)port);
201 ASSERT_EQ(r, 0);
202 tv.tv_sec = 5;
203 tv.tv_usec = 0;
204 r = driver->event_wait(fired_events, &tv);
205 ASSERT_EQ(r, 1);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
206 ASSERT_EQ(fired_events[0].fd, listen_sd);
207
208 fired_events.clear();
209 int client_sd = ::accept(listen_sd, NULL, NULL);
210 ASSERT_TRUE(client_sd > 0);
211 r = driver->add_event(client_sd, EVENT_NONE, EVENT_READABLE);
/test/msgr/test_async_driver.cc: 210 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
204 r = driver->event_wait(fired_events, &tv);
205 ASSERT_EQ(r, 1);
206 ASSERT_EQ(fired_events[0].fd, listen_sd);
207
208 fired_events.clear();
209 int client_sd = ::accept(listen_sd, NULL, NULL);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
210 ASSERT_TRUE(client_sd > 0);
211 r = driver->add_event(client_sd, EVENT_NONE, EVENT_READABLE);
212 ASSERT_EQ(r, 0);
213
214 do {
215 fired_events.clear();
/test/msgr/test_async_driver.cc: 212 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
206 ASSERT_EQ(fired_events[0].fd, listen_sd);
207
208 fired_events.clear();
209 int client_sd = ::accept(listen_sd, NULL, NULL);
210 ASSERT_TRUE(client_sd > 0);
211 r = driver->add_event(client_sd, EVENT_NONE, EVENT_READABLE);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
212 ASSERT_EQ(r, 0);
213
214 do {
215 fired_events.clear();
216 tv.tv_sec = 5;
217 tv.tv_usec = 0;
/test/msgr/test_async_driver.cc: 219 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
213
214 do {
215 fired_events.clear();
216 tv.tv_sec = 5;
217 tv.tv_usec = 0;
218 r = driver->event_wait(fired_events, &tv);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
219 ASSERT_EQ(r, 1);
220 ASSERT_EQ(fired_events[0].mask, EVENT_READABLE);
221
222 fired_events.clear();
223 char data[100];
224 r = ::read(client_sd, data, sizeof(data));
/test/msgr/test_async_driver.cc: 220 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
214 do {
215 fired_events.clear();
216 tv.tv_sec = 5;
217 tv.tv_usec = 0;
218 r = driver->event_wait(fired_events, &tv);
219 ASSERT_EQ(r, 1);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
220 ASSERT_EQ(fired_events[0].mask, EVENT_READABLE);
221
222 fired_events.clear();
223 char data[100];
224 r = ::read(client_sd, data, sizeof(data));
225 if (r == 0)
/test/msgr/test_async_driver.cc: 227 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
221
222 fired_events.clear();
223 char data[100];
224 r = ::read(client_sd, data, sizeof(data));
225 if (r == 0)
226 break;
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
230 ASSERT_EQ(r, 1);
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
/test/msgr/test_async_driver.cc: 230 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
224 r = ::read(client_sd, data, sizeof(data));
225 if (r == 0)
226 break;
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
230 ASSERT_EQ(r, 1);
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
233 ASSERT_EQ(r, strlen(data));
234 driver->del_event(client_sd, EVENT_READABLE|EVENT_WRITABLE,
235 EVENT_WRITABLE);
/test/msgr/test_async_driver.cc: 231 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
225 if (r == 0)
226 break;
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
230 ASSERT_EQ(r, 1);
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
233 ASSERT_EQ(r, strlen(data));
234 driver->del_event(client_sd, EVENT_READABLE|EVENT_WRITABLE,
235 EVENT_WRITABLE);
236 } while (1);
/test/msgr/test_async_driver.cc: 233 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
230 ASSERT_EQ(r, 1);
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
232 r = write(client_sd, data, strlen(data));
>>> CID 1254375: Resource leak (RESOURCE_LEAK)
>>> Handle variable "listen_sd" going out of scope leaks the handle.
233 ASSERT_EQ(r, strlen(data));
234 driver->del_event(client_sd, EVENT_READABLE|EVENT_WRITABLE,
235 EVENT_WRITABLE);
236 } while (1);
237
238 ::close(client_sd);
________________________________________________________________________________________________________
*** CID 1254380: Uninitialized scalar variable (UNINIT)
/test/msgr/test_async_driver.cc: 147 in echoclient(void *)()
141 int connect_sd = ::socket(AF_INET, SOCK_STREAM, 0);
142 struct sockaddr_in sa;
143 sa.sin_family = AF_INET;
144 sa.sin_port = htons(port);
145 char addr[] = "127.0.0.1";
146 int r = inet_aton(addr, &sa.sin_addr);
>>> CID 1254380: Uninitialized scalar variable (UNINIT)
>>> Using uninitialized value "sa". Field "sa.sin_zero" is uninitialized when calling "connect".
147 r = connect(connect_sd, (struct sockaddr*)&sa, sizeof(sa));
148 int t = 0;
149
150 do {
151 char c[] = "banner";
152 r = write(connect_sd, c, sizeof(c));
________________________________________________________________________________________________________
*** CID 1254379: Uninitialized scalar variable (UNINIT)
/test/msgr/test_async_driver.cc: 116 in EventDriverTest_PipeTest_Test::TestBody()()
110 r = driver->add_event(fds[0], EVENT_NONE, EVENT_READABLE);
111 ASSERT_EQ(r, 0);
112 r = driver->event_wait(fired_events, &tv);
113 ASSERT_EQ(r, 0);
114
115 char c;
>>> CID 1254379: Uninitialized scalar variable (UNINIT)
>>> Using uninitialized value "c" when calling "write".
116 r = write(fds[1], &c, sizeof(c));
117 ASSERT_EQ(r, 1);
118 r = driver->event_wait(fired_events, &tv);
119 ASSERT_EQ(r, 1);
120 ASSERT_EQ(fired_events[0].fd, fds[0]);
121
________________________________________________________________________________________________________
*** CID 1254381: Uninitialized scalar field (UNINIT_CTOR)
/msg/async/EventSelect.h: 34 in SelectDriver::SelectDriver(CephContext *)()
28 * FD sets after select(). */
29 fd_set _rfds, _wfds;
30 int max_fd;
31 CephContext *cct;
32
33 public:
>>> CID 1254381: Uninitialized scalar field (UNINIT_CTOR)
>>> Non-static class member "max_fd" is not initialized in this constructor nor in any functions that it calls.
34 SelectDriver(CephContext *c): cct(c) {}
35 virtual ~SelectDriver() {}
36
37 int init(int nevent);
38 int add_event(int fd, int cur_mask, int add_mask);
39 void del_event(int fd, int cur_mask, int del_mask);
________________________________________________________________________________________________________
*** CID 1254377: String not null terminated (STRING_NULL)
/test/msgr/test_async_driver.cc: 232 in EventDriverTest_NetworkSocketTest_Test::TestBody()()
226 break;
227 ASSERT_TRUE(r > 0);
228 r = driver->add_event(client_sd, EVENT_READABLE, EVENT_WRITABLE);
229 r = driver->event_wait(fired_events, &tv);
230 ASSERT_EQ(r, 1);
231 ASSERT_EQ(fired_events[0].mask, EVENT_WRITABLE);
>>> CID 1254377: String not null terminated (STRING_NULL)
>>> Passing unterminated string "data" to "strlen", which expects a null-terminated string.
232 r = write(client_sd, data, strlen(data));
233 ASSERT_EQ(r, strlen(data));
234 driver->del_event(client_sd, EVENT_READABLE|EVENT_WRITABLE,
235 EVENT_WRITABLE);
236 } while (1);
237
________________________________________________________________________________________________________
*** CID 1254378: Uncaught exception (UNCAUGHT_EXCEPT)
/test/msgr/test_async_driver.cc: 269 in main()
263 // must be defined). This dummy test keeps gtest_main linked in.
264 TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
265
266 #endif
267
268
>>> CID 1254378: Uncaught exception (UNCAUGHT_EXCEPT)
>>> In function "main(int, char **)" an exception of type "ceph::FailedAssertion" is thrown and never caught.
269 int main(int argc, char **argv) {
270 vector<const char*> args;
271 argv_to_vec(argc, (const char **)argv, args);
272
273 global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
274 common_init_finish(g_ceph_context);
/test/msgr/test_async_driver.cc: 269 in main()
263 // must be defined). This dummy test keeps gtest_main linked in.
264 TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
265
266 #endif
267
268
>>> CID 1254378: Uncaught exception (UNCAUGHT_EXCEPT)
>>> In function "main(int, char **)" an exception of type "ceph::FailedAssertion" is thrown and never caught.
269 int main(int argc, char **argv) {
270 vector<const char*> args;
271 argv_to_vec(argc, (const char **)argv, args);
272
273 global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
274 common_init_finish(g_ceph_context);
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/25?tab=overview
To unsubscribe from the email notification for new defects, http://scan5.coverity.com/cgi-bin/unsubscribe.py
next reply other threads:[~2014-11-14 14:21 UTC|newest]
Thread overview: 124+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 14:21 scan-admin [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-08-20 12:22 New Defects reported by Coverity Scan for ceph scan-admin
2022-08-20 13:17 ` Jeff Layton
2022-08-22 3:54 ` Brad Hubbard
2022-08-23 12:52 ` Jeff Layton
2018-01-04 3:32 scan-admin
2017-12-28 1:57 scan-admin
2017-12-21 1:54 scan-admin
2017-12-21 3:34 ` Jos Collin
2017-12-21 4:03 ` Brad Hubbard
2017-12-14 6:49 scan-admin
2017-12-01 2:25 scan-admin
2017-11-23 0:19 scan-admin
2017-11-16 11:35 scan-admin
2017-11-09 11:36 scan-admin
2017-11-02 2:11 scan-admin
2017-10-27 0:31 scan-admin
2017-10-19 3:54 scan-admin
2017-10-12 5:54 scan-admin
2017-10-05 5:08 scan-admin
2017-09-28 5:09 scan-admin
2017-09-21 6:44 scan-admin
2017-09-14 7:19 scan-admin
2017-09-07 5:08 scan-admin
2017-08-31 6:39 scan-admin
2017-08-24 23:32 scan-admin
2017-08-17 3:29 scan-admin
2017-08-10 3:50 scan-admin
2017-08-03 4:57 scan-admin
2017-07-27 3:50 scan-admin
2017-07-28 18:42 ` Gregory Farnum
2017-07-28 22:22 ` Brad Hubbard
2017-07-20 4:08 scan-admin
2017-07-13 5:11 scan-admin
2017-07-06 5:03 scan-admin
2017-06-29 4:08 scan-admin
2017-06-22 4:27 scan-admin
2017-06-15 9:50 scan-admin
2017-06-11 23:46 scan-admin
2017-06-01 4:33 scan-admin
2017-05-25 6:22 scan-admin
2017-05-18 1:44 scan-admin
2017-05-11 5:32 scan-admin
2017-05-04 2:45 scan-admin
2017-04-27 2:22 scan-admin
2017-04-20 5:34 scan-admin
2017-04-13 6:25 scan-admin
2017-04-06 9:40 scan-admin
2017-03-31 1:25 scan-admin
2017-03-23 7:58 scan-admin
2017-03-16 7:37 scan-admin
2017-03-09 6:12 scan-admin
2017-03-02 7:44 scan-admin
2017-02-23 9:09 scan-admin
2017-02-17 2:29 scan-admin
[not found] ` <CAJE9aOMoxWjhq=g+25hfhMhxSCnHAOwAyNhXvkxS1wwBEd3j+A@mail.gmail.com>
2017-02-17 5:19 ` kefu chai
2017-02-05 10:08 scan-admin
2017-01-27 13:22 scan-admin
2017-01-17 3:01 scan-admin
2017-01-09 10:05 scan-admin
2016-12-30 8:33 scan-admin
2016-12-23 9:16 scan-admin
2016-12-16 8:54 scan-admin
2016-12-09 11:29 scan-admin
2016-12-02 11:08 scan-admin
2016-11-25 7:55 scan-admin
2016-03-19 17:58 scan-admin
2016-03-13 17:40 scan-admin
2016-03-12 18:04 scan-admin
2016-03-05 17:55 scan-admin
2016-03-07 20:59 ` Gregory Farnum
2016-02-27 18:07 scan-admin
2016-02-20 18:26 scan-admin
2016-02-18 20:32 scan-admin
2016-02-13 17:47 scan-admin
2016-02-11 17:57 scan-admin
2016-02-11 22:01 ` Gregory Farnum
2016-02-12 16:36 ` Adam C. Emerson
2016-02-04 20:39 scan-admin
2016-02-03 20:40 scan-admin
2015-05-02 14:37 scan-admin
2015-01-21 1:41 scan-admin
2015-01-16 14:39 scan-admin
2015-01-16 15:17 ` Gregory Farnum
2015-01-16 16:00 ` John Spray
2015-01-16 16:08 ` Sage Weil
[not found] <54b528bef1f63_1b74f3532c63410@scan.coverity.com.mail>
2015-01-13 14:34 ` Sage Weil
2015-01-13 14:16 scan-admin
2015-01-10 14:36 scan-admin
2015-01-10 15:48 ` Haomai Wang
2015-01-09 14:30 scan-admin
2015-01-09 15:26 ` Sage Weil
2015-01-09 15:32 ` Danny Al-Gaaf
2015-01-04 14:14 scan-admin
2014-12-27 14:13 scan-admin
2014-12-28 6:03 ` Sage Weil
2014-12-26 14:19 scan-admin
2014-12-23 14:37 scan-admin
2014-12-21 14:13 scan-admin
2014-12-18 14:19 scan-admin
2014-12-14 14:17 scan-admin
2014-12-07 20:36 scan-admin
2014-12-05 14:11 scan-admin
2014-12-02 14:09 scan-admin
2014-11-25 14:09 scan-admin
2014-11-23 14:08 scan-admin
2014-11-20 14:20 scan-admin
2014-11-13 14:21 scan-admin
2014-11-11 20:40 scan-admin
2014-11-09 14:12 scan-admin
2014-10-30 13:19 scan-admin
2014-10-30 16:08 ` Sage Weil
2014-10-28 13:16 scan-admin
2014-10-28 18:26 ` Danny Al-Gaaf
2014-10-26 13:17 scan-admin
2014-10-24 17:55 scan-admin
2014-10-24 17:59 ` Sage Weil
2014-10-17 13:27 scan-admin
2014-10-09 13:23 scan-admin
2014-10-02 13:21 scan-admin
2014-09-25 13:18 scan-admin
2014-09-16 21:40 scan-admin
2014-08-16 21:31 scan-admin
2014-08-09 15:30 scan-admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54660ffe93e48_254aa9733843444@scan.coverity.com.mail \
--to=scan-admin@coverity.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox