Print this page
12276 smatch-clean sockfs

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/sockfs/nl7curi.c
          +++ new/usr/src/uts/common/fs/sockfs/nl7curi.c
↓ open down ↓ 1132 lines elided ↑ open up ↑
1133 1133  
1134 1134          if (sti->sti_nl7c_flags & NL7C_WAITWRITE) {
1135 1135                  sti->sti_nl7c_flags &= ~NL7C_WAITWRITE;
1136 1136                  first = B_TRUE;
1137 1137          } else {
1138 1138                  first = B_FALSE;
1139 1139          }
1140 1140  
1141 1141          alloc = kmem_alloc(sz, KM_SLEEP);
1142 1142          URI_RD_ADD(uri, rdp, sz, -1);
1143      -        if (rdp == NULL) {
1144      -                error = ENOMEM;
1145      -                goto fail;
1146      -        }
1147 1143  
1148 1144          if (uri->hash != URI_TEMP && uri->count > nca_max_cache_size) {
1149 1145                  uri_delete(uri);
1150 1146                  uri->hash = URI_TEMP;
1151 1147          }
1152 1148          data = alloc;
1153 1149          alloc = NULL;
1154 1150          rdp->data.kmem = data;
1155 1151          atomic_add_64(&nl7c_uri_bytes, sz);
1156 1152  
↓ open down ↓ 212 lines elided ↑ open up ↑
1369 1365                                  max = MAXBSIZE * nl7c_file_prefetch;
1370 1366                          }
1371 1367                          alloc = nl7c_readfile(fp, &off, &cnt, max, &error);
1372 1368                          if (alloc == NULL)
1373 1369                                  goto fail;
1374 1370  
1375 1371                          releasef(sfvp->sfv_fd);
1376 1372                          fp = NULL;
1377 1373                  }
1378 1374                  URI_RD_ADD(uri, rdp, cnt, -1);
1379      -                if (rdp == NULL) {
1380      -                        error = ENOMEM;
1381      -                        goto fail;
1382      -                }
1383 1375                  data = alloc;
1384 1376                  alloc = NULL;
1385 1377                  rdp->data.kmem = data;
1386 1378                  total_count += cnt;
1387 1379                  if (uri->hash != URI_TEMP && total_count > nca_max_cache_size) {
1388 1380                          uri_delete(uri);
1389 1381                          uri->hash = URI_TEMP;
1390 1382                  }
1391 1383  
1392 1384                  /* Response parse */
↓ open down ↓ 5 lines elided ↑ open up ↑
1398 1390                  if (error)
1399 1391                          goto fail;
1400 1392  
1401 1393                  if (sfvp->sfv_fd != SFV_FD_SELF) {
1402 1394                          /*
1403 1395                           * File descriptor, if any bytes left save vnode_t.
1404 1396                           */
1405 1397                          if (len > cnt) {
1406 1398                                  /* More file data so add it */
1407 1399                                  URI_RD_ADD(uri, rdp, len - cnt, off);
1408      -                                if (rdp == NULL) {
1409      -                                        error = ENOMEM;
1410      -                                        goto fail;
1411      -                                }
1412 1400                                  rdp->data.vnode = vp;
1413 1401  
1414 1402                                  /* Send vnode data out the connection */
1415 1403                                  error = uri_rd_response(so, uri, rdp, first);
1416 1404                          } else {
1417 1405                                  /* All file data fit in the prefetch */
1418 1406                                  VN_RELE(vp);
1419 1407                          }
1420 1408                          *fileoff += len;
1421 1409                          vp = NULL;
↓ open down ↓ 736 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX