case IBLND_REJECT_MSG_QUEUE_SIZE:
CERROR("%s rejected: incompatible message queue depth %d, %d\n",
- libcfs_nid2str(peer->ibp_nid), cp->ibcp_queue_depth,
- IBLND_MSG_QUEUE_SIZE(conn->ibc_version));
+ libcfs_nid2str(peer->ibp_nid),
+ cp != NULL ? cp->ibcp_queue_depth :
+ IBLND_MSG_QUEUE_SIZE(rej->ibr_version),
+ IBLND_MSG_QUEUE_SIZE(conn->ibc_version));
break;
case IBLND_REJECT_RDMA_FRAGS:
CERROR("%s rejected: incompatible # of RDMA fragments %d, %d\n",
- libcfs_nid2str(peer->ibp_nid), cp->ibcp_max_frags,
- IBLND_RDMA_FRAGS(conn->ibc_version));
+ libcfs_nid2str(peer->ibp_nid),
+ cp != NULL ? cp->ibcp_max_frags :
+ IBLND_RDMA_FRAGS(rej->ibr_version),
+ IBLND_RDMA_FRAGS(conn->ibc_version));
break;
case IBLND_REJECT_NO_RESOURCES:
best_npeers = iface->ksni_npeers;
}
+ LASSERT(best_iface != NULL);
+
best_iface->ksni_npeers++;
ip = best_iface->ksni_ipaddr;
peer->ksnp_passive_ips[i] = ip;
peer->ksnp_n_passive_ips = i+1;
}
- LASSERT (best_iface != NULL);
-
/* mark the best matching peer IP used */
j = ksocknal_match_peerip(best_iface, peerips, n_peerips);
peerips[j] = 0;
static void
lnet_destroy_remote_nets_table(void)
{
- int i;
- cfs_list_t *hash;
+ int i;
if (the_lnet.ln_remote_nets_hash == NULL)
return;
LASSERT(cfs_list_empty(&the_lnet.ln_remote_nets_hash[i]));
LIBCFS_FREE(the_lnet.ln_remote_nets_hash,
- LNET_REMOTE_NETS_HASH_SIZE * sizeof(*hash));
+ LNET_REMOTE_NETS_HASH_SIZE *
+ sizeof(the_lnet.ln_remote_nets_hash[0]));
the_lnet.ln_remote_nets_hash = NULL;
}
lnet_notify_locked(lp, ni == NULL, alive, when);
- lnet_ni_notify_locked(ni, lp);
+ if (ni != NULL)
+ lnet_ni_notify_locked(ni, lp);
lnet_peer_decref_locked(lp);
goto out;
LIBCFS_ALLOC(dst_name, args->lstio_tes_dgrp_nmlen + 1);
- if (dst_name == NULL)
+ if (dst_name == NULL)
goto out;
if (args->lstio_tes_param != NULL) {
LIBCFS_ALLOC(param, args->lstio_tes_param_len);
if (param == NULL)
goto out;
+ if (copy_from_user(param, args->lstio_tes_param,
+ args->lstio_tes_param_len)) {
+ rc = -EFAULT;
+ goto out;
+ }
}
rc = -EFAULT;
copy_from_user(src_name, args->lstio_tes_sgrp_name,
args->lstio_tes_sgrp_nmlen) ||
copy_from_user(dst_name, args->lstio_tes_dgrp_name,
- args->lstio_tes_dgrp_nmlen) ||
- copy_from_user(param, args->lstio_tes_param,
- args->lstio_tes_param_len))
+ args->lstio_tes_dgrp_nmlen))
goto out;
rc = lstcon_test_add(batch_name,
return 0;
}
- reply->dbg_status = 0;
- reply->dbg_sid = sn->sn_id;
- reply->dbg_timeout = sn->sn_timeout;
+ reply->dbg_status = 0;
+ reply->dbg_sid = sn->sn_id;
+ reply->dbg_timeout = sn->sn_timeout;
if (strlcpy(reply->dbg_name, &sn->sn_name[0], sizeof(reply->dbg_name))
>= sizeof(reply->dbg_name))
return -E2BIG;
static inline int
sfw_test_buffers(sfw_test_instance_t *tsi)
{
- struct sfw_test_case *tsc = sfw_find_test_case(tsi->tsi_service);
- struct srpc_service *svc = tsc->tsc_srv_service;
+ struct sfw_test_case *tsc;
+ struct srpc_service *svc;
int nbuf;
+ LASSERT(tsi != NULL);
+ tsc = sfw_find_test_case(tsi->tsi_service);
+ LASSERT(tsc != NULL);
+ svc = tsc->tsc_srv_service;
+ LASSERT(svc != NULL);
+
nbuf = min(svc->sv_wi_total, tsi->tsi_loop) / svc->sv_ncpts;
return max(SFW_TEST_WI_MIN, nbuf + SFW_TEST_WI_EXTRA);
}
void
sfw_unload_test(struct sfw_test_instance *tsi)
{
- struct sfw_test_case *tsc = sfw_find_test_case(tsi->tsi_service);
+ struct sfw_test_case *tsc;
+ LASSERT(tsi != NULL);
+ tsc = sfw_find_test_case(tsi->tsi_service);
LASSERT(tsc != NULL);
if (tsi->tsi_is_client)
int jt_dbg_debug_kernel(int argc, char **argv)
{
- char filename[4096];
- struct stat st;
+ struct stat st;
+ char filename[PATH_MAX];
int raw = 0;
int save_errno;
int fdin;
* then dump directly to any supplied filename, otherwise this is
* just a temp file and we dump to the real file at convert time. */
if (argc > 1 && raw) {
- if (strlen(argv[1]) > sizeof(filename)-1) {
+ if (strlen(argv[1]) >= sizeof(filename)) {
fprintf(stderr, "File name too long: %s\n", argv[1]);
return 1;
}
} else {
if (snprintf(filename, sizeof(filename), "%s"CFS_TIME_T".%u",
LIBCFS_DEBUG_FILE_PATH_DEFAULT, time(NULL),
- getpid()) >=
- sizeof(filename)) {
+ getpid())
+ >= sizeof(filename)) {
fprintf(stderr, "File name too long\n");
return 1;
}
int jt_dbg_mark_debug_buf(int argc, char **argv)
{
- static char scratch[MAX_MARK_SIZE] = { '\0' };
- int rc, max_size = MAX_MARK_SIZE-1;
- struct libcfs_ioctl_data data = { 0 };
- char *text;
- time_t now = time(NULL);
-
- if (argc > 1) {
- int count;
- text = scratch;
- strncpy(text, argv[1], max_size);
- max_size-=strlen(argv[1]);
- for (count = 2; (count < argc) && (max_size > 0); count++){
- strncat(text, " ", max_size);
- max_size -= 1;
- strncat(text, argv[count], max_size);
- max_size -= strlen(argv[count]);
- }
- } else {
- text = ctime(&now);
- }
+ static char scratch[MAX_MARK_SIZE] = "";
+ struct libcfs_ioctl_data data = { 0 };
+ char *text;
+ int rc;
+
+ if (argc > 1) {
+ int count, max_size = sizeof(scratch) - 1;
+
+ strncpy(scratch, argv[1], max_size);
+ max_size -= strlen(argv[1]);
+ for (count = 2; (count < argc) && (max_size > 1); count++) {
+ strncat(scratch, " ", max_size);
+ max_size -= 1;
+ strncat(scratch, argv[count], max_size);
+ max_size -= strlen(argv[count]);
+ }
+ scratch[sizeof(scratch) - 1] = '\0';
+ text = scratch;
+ } else {
+ time_t now = time(NULL);
+ text = ctime(&now);
+ }
- data.ioc_inllen1 = strlen(text) + 1;
- data.ioc_inlbuf1 = text;
+ data.ioc_inllen1 = strlen(text) + 1;
+ data.ioc_inlbuf1 = text;
if (libcfs_ioctl_pack(&data, &buf, max) != 0) {
fprintf(stderr, "libcfs_ioctl_pack failed.\n");
return -1;
char *path = "";
const char *proc = "/proc/modules";
char modname[128], buf[4096];
- long modaddr;
+ unsigned long modaddr;
FILE *file;
if (argc >= 2)
{
int rc;
lnet_nid_t nid;
- unsigned int threshold;
+ int threshold;
struct libcfs_ioctl_data data;
if (argc < 2 || argc > 3)
if (argc < 3) {
threshold = LNET_MD_THRESH_INF;
- } else if (sscanf (argv[2], "%i", &threshold) != 1) {
+ } else if (sscanf(argv[2], "%i", &threshold) != 1) {
fprintf (stderr, "Can't parse count \"%s\"\n", argv[2]);
return (-1);
}