mirror of
https://github.com/samba-team/samba.git
synced 2025-03-22 02:50:28 +03:00
ctdb_req_control contains 4 padding bytes. Create an explicit pad variable here and set it to 0 when creating a control to keep valgrind happy.
PDUs are padded to 8 byte boundary. If padding is used, memset it to 0 to keep valgrind happy. (This used to be ctdb commit 8818d5c483558c0faa6a3923ed5e675fdcfc13af)
This commit is contained in:
parent
0844759964
commit
2d4b98381f
@ -410,6 +410,7 @@ struct ctdb_reply_getdbpath {
|
||||
struct ctdb_req_control {
|
||||
struct ctdb_req_header hdr;
|
||||
uint32_t opcode;
|
||||
uint32_t pad;
|
||||
uint64_t srvid;
|
||||
uint32_t client_id;
|
||||
#define CTDB_CTRL_FLAG_NOREPLY 1
|
||||
|
@ -354,6 +354,7 @@ struct ctdb_request *new_ctdb_control_request(struct ctdb_connection *ctdb,
|
||||
CTDB_REQ_CONTROL, destnode, new_reqid(ctdb));
|
||||
|
||||
pkt = req->hdr.control;
|
||||
pkt->pad = 0;
|
||||
pkt->opcode = opcode;
|
||||
pkt->srvid = 0;
|
||||
pkt->client_id = 0;
|
||||
|
@ -17,6 +17,7 @@
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
@ -34,6 +35,8 @@ struct io_elem {
|
||||
struct io_elem *new_io_elem(size_t len)
|
||||
{
|
||||
struct io_elem *elem;
|
||||
size_t ask = len;
|
||||
|
||||
len = (len + (CTDB_DS_ALIGNMENT-1)) & ~(CTDB_DS_ALIGNMENT-1);
|
||||
|
||||
elem = malloc(sizeof(*elem));
|
||||
@ -45,6 +48,10 @@ struct io_elem *new_io_elem(size_t len)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* stamp out any padding to keep valgrind happy */
|
||||
if (ask != len) {
|
||||
memset(elem->data + ask, 0, len-ask);
|
||||
}
|
||||
elem->len = len;
|
||||
elem->off = 0;
|
||||
return elem;
|
||||
|
Loading…
x
Reference in New Issue
Block a user