1931
1932 /* Do some boundary checking */
1933 if ((size < 0) || (size > sv_max_devices)) {
1934 /* Array size is out of range */
1935 return (spcs_s_ocopyoutf(&kstatus, ustatus,
1936 SV_EARRBOUNDS, "0",
1937 spcs_s_inttostring(sv_max_devices, itmp1,
1938 sizeof (itmp1), 0),
1939 spcs_s_inttostring(size, itmp2,
1940 sizeof (itmp2), 0)));
1941 }
1942
1943 if (ilp32)
1944 bytes = size * sizeof (sv_name32_t);
1945 else
1946 bytes = size * sizeof (sv_name_t);
1947
1948 /* Allocate memory for the array of structures */
1949 if (bytes != 0) {
1950 svn = kmem_zalloc(bytes, KM_SLEEP);
1951 if (!svn) {
1952 return (spcs_s_ocopyoutf(&kstatus,
1953 ustatus, ENOMEM));
1954 }
1955 }
1956
1957 rc = sv_list(svn, size, rvalp, ilp32);
1958 if (rc) {
1959 if (svn != NULL)
1960 kmem_free(svn, bytes);
1961 return (spcs_s_ocopyoutf(&kstatus, ustatus, rc));
1962 }
1963
1964 if (ilp32) {
1965 svl32.svl_timestamp = (uint32_t)sv_config_time;
1966 svl32.svl_maxdevs = (int32_t)sv_max_devices;
1967
1968 /* Return the list structure */
1969 if (ddi_copyout(&svl32, (void *)arg,
1970 sizeof (svl32), mode) < 0) {
1971 spcs_s_kfree(kstatus);
1972 if (svn != NULL)
1973 kmem_free(svn, bytes);
1974 return (EFAULT);
|
1931
1932 /* Do some boundary checking */
1933 if ((size < 0) || (size > sv_max_devices)) {
1934 /* Array size is out of range */
1935 return (spcs_s_ocopyoutf(&kstatus, ustatus,
1936 SV_EARRBOUNDS, "0",
1937 spcs_s_inttostring(sv_max_devices, itmp1,
1938 sizeof (itmp1), 0),
1939 spcs_s_inttostring(size, itmp2,
1940 sizeof (itmp2), 0)));
1941 }
1942
1943 if (ilp32)
1944 bytes = size * sizeof (sv_name32_t);
1945 else
1946 bytes = size * sizeof (sv_name_t);
1947
1948 /* Allocate memory for the array of structures */
1949 if (bytes != 0) {
1950 svn = kmem_zalloc(bytes, KM_SLEEP);
1951 }
1952
1953 rc = sv_list(svn, size, rvalp, ilp32);
1954 if (rc) {
1955 if (svn != NULL)
1956 kmem_free(svn, bytes);
1957 return (spcs_s_ocopyoutf(&kstatus, ustatus, rc));
1958 }
1959
1960 if (ilp32) {
1961 svl32.svl_timestamp = (uint32_t)sv_config_time;
1962 svl32.svl_maxdevs = (int32_t)sv_max_devices;
1963
1964 /* Return the list structure */
1965 if (ddi_copyout(&svl32, (void *)arg,
1966 sizeof (svl32), mode) < 0) {
1967 spcs_s_kfree(kstatus);
1968 if (svn != NULL)
1969 kmem_free(svn, bytes);
1970 return (EFAULT);
|