Commit Graph

11109 Commits

Author SHA1 Message Date
Jeffrey Altman
9a8fa5d64f Windows: ReleaseNotes reformatting
Oxygen 14.2 automatically reformatted the text.

Change-Id: I387627948f449c96ed3ab112371752f4673b24d9
Reviewed-on: http://gerrit.openafs.org/9212
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-23 00:22:16 -08:00
Jeffrey Altman
2ca80b4b6a Windows: Direct IO Support for Service
This patchset implements and enables by default the new
Direct IO pathway between the AFS redirector and the afsd_service.exe.
When Direct IO is enabled all reads and writes are performed by the
AFS redirector locking memory allocated by the kernel and mapping it into
the service's memory address space.

The service supports cache bypass in this mode when the
AFS_REQUEST_FLAG_CACHE_BYPASS flag is set in the request from the
redirector.  When cache bypass is active, the AFSCache file is ignored and
data is either directly fetched from or stored to the file server.  Cache
bypass is enabled by IIS and other applications that request no
intermediate buffering when opening file handles.   This is often done
because the application implements its own data caching.  All cache bypass
store operations are synchronous.

When cache bypass is not enabled, the memory region provided by the AFS
redirector is either used to populate the cm_buf_t objects or is populated
by them.  When cache bypass is not enabled, one outstanding store
operation can be in flight asynchronously to improve performance.

Direct IO is enabled by default and can be disabled by creating the
registry value.

  ..\Services\TransarcAFSDaemon\Parameters
  "DirectIO"  DWORD  0x0

Change-Id: I3cac3660c8b8eded58226ba4a819692c454704a8
Reviewed-on: http://gerrit.openafs.org/9211
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-23 00:22:04 -08:00
Peter Scott
be0296a8ad Windows: Direct IO for AFS Redirector
Implement a new IO processing model in which extents are not passed between
afsredirlib.sys and afsd_service.exe.  Instead the AFSCache file is
maintained exclusively by the service and the redirector locks kernel
memory, maps it into the service's address space, and permits the service
to manage all IO directly.

This interface adds an AFS Cache Bypass option to the AFS Redirector which
is activated when the file handle has been opened with the no intermediate
buffering option.

This patchset implements the kernel interface.  A subsequent
patchset will implement the service component.

Assisted by Jeffrey Altman <jaltman@your-file-system.com>

Change-Id: I25a4764db060b3b3f2b0de4006479dd3a220c6eb
Reviewed-on: http://gerrit.openafs.org/9210
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-23 00:21:48 -08:00
Jeffrey Altman
49329541a1 Windows: Add flag BUF_GET_FLAG_BUFCREATE_LOCKED
Modify the buf_Get() and buf_GetNewLocked() interfaces to
permit the cm_scache.bufCreateLocked lock to be held prior to
calling to buf_Get().  Holding the cm_scache.bufCreateLocked lock
before the buf_Get() call prevents a race with another thread
that attempts to set the file size.

Change-Id: I54b13c83801a4d9a2078552d5be7ada6f4607850
Reviewed-on: http://gerrit.openafs.org/9209
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-23 00:21:34 -08:00
Jeffrey Altman
225b0e8085 Windows: Set AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED
Set the ObjectInformationCB AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED flag
from within the AFSEnumerateDirectory() function and not from its callers.

Change-Id: I2bddedba1165557679ddd9c637dbeb85cd74e1de
Reviewed-on: http://gerrit.openafs.org/9119
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-23 00:21:18 -08:00
Peter Scott
b7ba97ad53 Windows: Permit direct to service non-wildcard lookups
The AFS redirector has required that directories be fully enumerated
when the directory object is opened.  This is a very expensive
operation involving large numbers of file server RPC round trips for
directories with tens of thousands of objects and those containing
symlinks.

This patchset delays directory enumeration for the last component
in a path until such time as dirctory data is requested by the
application.  If the request is for a non-wildcard pattern, the
service will be asked to provide the details for just the one required
object.

Delaying the directory enumeration improves performance for
GetFileAttributes[Ex], GetDiskFreeSpace[Ex], GetVolumeInformation,
and GetNamedSecurityInfo Win32 API calls.   In those cases it is
no longer necessary to enumerate the target directory at all.

Change-Id: I7ef2fbafff925697d8b40e56837ef53bfcc78542
Reviewed-on: http://gerrit.openafs.org/9118
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-23 00:21:07 -08:00
Jeffrey Altman
0dd623ea9a Windows: EvalByName pass LastComponent flag
Add AFS_REQUEST_FLAG_LAST_COMPONENT flag for use with
AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME requests to the service.
When set the service will perform cm_Lookup calls without the
CM_FLAG_CHECKPATH flag set.

Change-Id: I47ec2fb8b1e2699f2d87a6625b1db549ecb4e03d
Reviewed-on: http://gerrit.openafs.org/9133
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-23 00:20:52 -08:00
Jeffrey Altman
6896ca2cc3 Windows: EvaluateByName support case-insensitive lookups
Directory lookups in AFS should favor case-sensivite matches
but permit case-insensitive matches otherwise.  The service
should not follow mount points.  The redirector exposes mount
points as junctions.

Change-Id: I34c9244e2756a926f29bbf184dc250e7a29d264f
Reviewed-on: http://gerrit.openafs.org/9132
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-22 13:22:43 -08:00
Jeffrey Altman
03bac87d16 Windows: IO Subsystem Trace modifications
Display file offsets consistently as %0I64X.

Change-Id: Ib1484ef99fbf055ec4bc00e17469e0daa9661e96
Reviewed-on: http://gerrit.openafs.org/9129
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-22 13:12:52 -08:00
Rod Widdowson
6e6c1b9aa2 Windows: Move work item queues over to the Control Device
Currently, when the library is unloaded it stops all worker
threands and then evaporates the work item queues.  Thus
any work items which are pending will disappear.

Whilst it is OK that the threads going away, any work items need to
remain queued so that when the library is restarted the work
can continue.  This checkin does this by moving the work item
queues and their synchronization primitives into the FS maintained
Control Device Object Extension.  The list of worker threads
remains in the Library Device Object Extension.

Change-Id: If5c7cd3bdfea1a368c8df69649e627bac3a9585f
Reviewed-on: http://gerrit.openafs.org/9139
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-22 13:12:06 -08:00
Jeffrey Altman
6136b236c4 Windows: Initialize Irp->IoStatus.Information earlier
Initialize Irp->IoStatus.Information to zero immediately upon
beginning processing of the IRP in the write path.

Change-Id: I8d5a717ae8cd3bc44c2a9a65b34fd0549862d293
Reviewed-on: http://gerrit.openafs.org/9128
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-22 13:11:51 -08:00
Rod Widdowson
11aa3e09e5 Windows: Call CcDeferWrite rather than loop
If we are about to write into the cache and we do not have enough
memory we call CcDeferWrite and return STATUS_PENDING.  This allows
the cache to call us back when there is memory.

The write is performed on the IO queue which is shared wth paging
writes.  However this does not cause paging writes to block in a
memory shortage situation since the request will either be deferred
again (releasing a thread to service a paging write) or will complete
quickly.  Further we allocate all our resources upfront so we fail
fast and in the appropriate place.

Change-Id: I4efbc14a97d3b34236643973f1f8f85c7ea194a6
Reviewed-on: http://gerrit.openafs.org/9127
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-22 13:11:40 -08:00
Rod Widdowson
82161c478a Windows: Allow the Library to pend a write request
If the library pends a request pending memory becoming available
then the FS must ensure that the library stays loaded until the
IRP is completed.

Change-Id: Idbfdd84ecd364c99d3ad9cd8dd7e000f47be4b58
Reviewed-on: http://gerrit.openafs.org/9126
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-22 13:11:30 -08:00
Rod Widdowson
6c1d28958d Windows: AFSWriteCommon collapse redundant condition
We never get non cached and yet paging IO.  Even if we did it would
be inappropriate to call CcCanIWrite.  Therefore, collapse two if
statements into one.

Change-Id: I95c9030836e4f7dc4f7867a8b8b09b97bf57b429
Reviewed-on: http://gerrit.openafs.org/9125
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-22 13:11:18 -08:00
Simon Wilkinson
5e859ff2c3 afsio: Ignore return values from afscp_SetDefault*
We don't do anything with the return values from afscp_SetDefaultCell
or afscp_SetDefaultRealm, so just ignore them.

Caught by clang-analyzer

Change-Id: Ib7d9e637e5d08df28ad0085302811b243fb21768
Reviewed-on: http://gerrit.openafs.org/9188
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-22 13:04:29 -08:00
Simon Wilkinson
ba8afdc344 afsio: Don't leak memory on GetVenusFidBy* failure
The GetVenusFid functions all allocate the fid structure immediately
upon entry to the function. When we return with an error, that structure
is never freed.

Update the call sites so that we don't leak this memory.

Caught by clang-analyzer

Change-Id: Iec62316d0fd542e70634f384c8319f90ba6b2649
Reviewed-on: http://gerrit.openafs.org/9187
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-22 13:04:18 -08:00
Simon Wilkinson
f67e4a3cdf libafscp: Actually return callback from FindCallback
Fix FindCallback so that it actually returns the callback that it
found. This requires changing the function prototype so that the
third parameter is passed by reference, and updating the single
call site.

Caught by clang-analyzer

Change-Id: I420647e9cfd119cf1a26456a91d595b8154ddd85
Reviewed-on: http://gerrit.openafs.org/9198
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-22 13:03:44 -08:00
Simon Wilkinson
86c7369ffa libafscp: Move server lookup inside AFSCP_DEBUG
We only use the results of the server lookup when AFSCP_DEBUG
is defined, so only bother actually doing the lookup when that
is set.

Caught by clang-analyzer

Change-Id: If79177e9d06817592b0630db7050cf3d40f3ee5f
Reviewed-on: http://gerrit.openafs.org/9197
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-22 13:03:39 -08:00
Simon Wilkinson
735c9cff53 libafscp: Don't free bogus ptr in ResolvPathFromVol
afscp_ResolvPathFromVol makes a copy of the path passed to it using
strdup. It then iterates across that, removing initial '/' characters.
However, this iteration means that 'p' no longer points to the start
of the allocated memory - when we free 'p', we may actually be freeing
an offset into the block, which will make malloc unhappy.

Make a copy of the result from strdup, and use that to free the block.

Caught by clang-analyzer

Change-Id: I0e7d8c7cf3b70baa4868c65fb4c3a32474557628
Reviewed-on: http://gerrit.openafs.org/9196
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-22 13:03:33 -08:00
Simon Wilkinson
f82acb79f2 libafscp: Fix leak when afscp_ResolvPath errors
If afscp_DefaultCell fails, then afscp_ResolvPath returns without
freeing the memory allocated to 'p' by strdup.

Fix this by adding a free() in the appropriate place.

Caught by clang-analyzer

Change-Id: Ic2691d209c913cd600d9a9a1ebb4614dff35aa3b
Reviewed-on: http://gerrit.openafs.org/9195
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-22 13:03:26 -08:00
Simon Wilkinson
860c34ba93 ptserver: Don't ignore ubik_Write failures
If we can't write to the ubik database, then that's a bad thing.
Don't ignore it.

Caught by clang-analyzer

Change-Id: I08b57a74405cc563c6141251fd3d433b2904ea0e
Reviewed-on: http://gerrit.openafs.org/9176
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-22 06:16:45 -08:00
Simon Wilkinson
df0b2d6775 ptserver: Tidy malloc handling in readpwd
Tidy up the malloc handling in readpwd, so that we don't leak memory
if the user specifies multiple -c arguments. Also avoid assuming that
free(NULL) will always work.

Change-Id: I95f3fe908572cb5be2d30345ccae0a2858622bd5
Reviewed-on: http://gerrit.openafs.org/9178
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:20:05 -08:00
Simon Wilkinson
7f9f54c919 ptserver: Remove some unnecessary assignments
Remove some assignments where we do nothing with the results

Caught by clang-analyzer

Change-Id: I6990a6b21ced10500275176af3f85b7f1cabd334
Reviewed-on: http://gerrit.openafs.org/9177
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:19:27 -08:00
Simon Wilkinson
0ecd78058c libacl: Remove unnecessary assignment
Don't assign i to j, when we never use j again in the function

Caught by clang-analyzer

Change-Id: I9dd2d929019ac3cc84cde4e44c4883806bd5964a
Reviewed-on: http://gerrit.openafs.org/9175
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:18:14 -08:00
Simon Wilkinson
a2aad6f451 kauth: Don't store the old signal routine
If we're not going to make use of the return from signal() don't
bother assigning it to a variable

Change-Id: I03cae7ab91d49e90f150a9dc4358c173920adc28
Reviewed-on: http://gerrit.openafs.org/9173
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:16:17 -08:00
Simon Wilkinson
95a05f49ea kauth: Remove unused assignments to bp
We never use the character pointer once we've advanced it past the
slash, so don't bother doing the work of advancing it.

Caught by clang-analyzer

Change-Id: I8ea561d6756685a13892f0635fa2e19b3f1233ab
Reviewed-on: http://gerrit.openafs.org/9171
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:09:05 -08:00
Simon Wilkinson
68ce3aa814 kauth: Remove unused lclpw structure from klog
klog assigns into, but never references, the lclpw structure. Just
remove it.

Caught by clang-analyzer

Change-Id: I8e94f97ee3ee6cb15193ad80dd9aef39e6f8490b
Reviewed-on: http://gerrit.openafs.org/9170
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:08:24 -08:00
Simon Wilkinson
37a3417f23 volser: Remove needless initialisation
Remove a number of places where we initialise a variable to NULL
immediately before we assign a real value to it.

Caught by clang-analyzer

Change-Id: I74ece8f3a82a5c768d769b74b4ccce12195fc216
Reviewed-on: http://gerrit.openafs.org/9169
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:07:39 -08:00
Simon Wilkinson
edbbcf5b62 volser: Remove masked assignment in vol_split
The declaration (and assignment) to size at the outermost scope
in the copyVnodes function is masked by a later declaration at a
inner scope.

Just remove the outer declaration to clarify what's happening.

Caught by clang-analyzer

Change-Id: If23bdcf8a4c2d23d6224762fecce35be9cf15873
Reviewed-on: http://gerrit.openafs.org/9168
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:03:23 -08:00
Simon Wilkinson
9122f81d15 vos: aserver is private
The server specified on the command line is used directly to
initialise the attributes structure. Move the variable so it's
local to the block which uses it, and remove the function-wide
initialiser.

Caught by clang-analyzer

Change-Id: Ia636fae2ed505f6958cefbfbaa72ef7e37edec98
Reviewed-on: http://gerrit.openafs.org/9165
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 22:02:37 -08:00
Simon Wilkinson
e816db093b auth: Avoid double free in key parsing
There was an error path whilst reading an extended key file which could
result in a key being freed using free(key), and then freed again
through the afsconf_typedKey_put() mechanism. Remove this double free.

Caught by clang-analyzer

Change-Id: I40bff56eddf4cb499ae5b7effdaf82f22379109d
Reviewed-on: http://gerrit.openafs.org/9147
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:09:49 -08:00
Simon Wilkinson
2ee578d800 ptserver: Use correct structure type in malloc
prentries is a list of 'struct prlistentries' objects, not a list of
'struct prentry'. Use the correct type in our call to malloc.

Caught by clang analyzer

Change-Id: I6c36e4b875eafb8aff6506cf800d47b45a79825d
Reviewed-on: http://gerrit.openafs.org/9150
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:09:01 -08:00
Simon Wilkinson
d7e7f18887 vol: nuke() doesn't need to zero code
We don't need to zero the result code two lines before we assign
a new value to it - just remove the pointless assignment

Caught by clang-analyzer

Change-Id: I8fefdc839ef9980d7f7703add3b11b089d524d38
Reviewed-on: http://gerrit.openafs.org/9167
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:07:19 -08:00
Simon Wilkinson
c696be9827 vol: nuke() doesn't need to maintain next inode ptr
ni is unused on the true side of the if expression in nuke() - so
just don't bother populating it.

Caught by clang-analyzer

Change-Id: Idfd088f999f4c4bcdabc03b8b86636aa02541343
Reviewed-on: http://gerrit.openafs.org/9166
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:06:41 -08:00
Simon Wilkinson
538f8d8363 rxgen: Remove pointless assignment
The value we assign to defp is never used (it's almost immediately
overwritten), and it is guaranteed to be the same as the existing
value. So, just remove the assignment.

Caught by clang-analyzer

Change-Id: I362fe08c623b5046f2c8b0b16c42dcfa12009981
Reviewed-on: http://gerrit.openafs.org/9162
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:02:51 -08:00
Simon Wilkinson
58cb6e60a8 rxgen: Fix memory leak
Don't leak the definition structure when we hit the end of the file

Change-Id: Ief44bb3bdff274167760fda5bcc16903ef8c11ce
Reviewed-on: http://gerrit.openafs.org/9159
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:02:06 -08:00
Simon Wilkinson
0d28f8c0ce rxgen: Fix NULL pointer dereference
Avoid a NULL pointer dereference if strchr doesn't find any occurence
of '*' in the string. Whilst we handle the not found case when inserting
a mid string terminator, we don't handle it when restoring the string to
its previous value.

Change-Id: Ie0b3e18d89073a1694bba2749111c73f59150bdb
Reviewed-on: http://gerrit.openafs.org/9158
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:01:37 -08:00
Simon Wilkinson
1e4800e1c6 rxgen: Silence some uninitialised variable warnings
Change-Id: Ida939533afbbf2afb81cce44ea6693d33c172062
Reviewed-on: http://gerrit.openafs.org/9157
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:00:53 -08:00
Simon Wilkinson
6d2d18dfeb Fix incorrect sizeof() arguments in allocations
In a number of places we have

struct X *val;
val = malloc(sizeof(struct Y));

If sizeof(struct Y) < sizeof(struct X) this is obviously dangerous,
but it is incorrect regardless of the relative sizes of the
structures. Fix all of the occurences of this that clang points out
to us.

Caught by clang-analyzer

Change-Id: Iad32b4ae460d3f40a45cf33624973bf52fd167d4
Reviewed-on: http://gerrit.openafs.org/9156
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 09:00:26 -08:00
Simon Wilkinson
03c04c081a Don't allocate objects of 0 length
Fix assorted places in the code where we might have asked malloc to
allocate a block of zero length.

Caught by clang-analyzer

Change-Id: I6e1226ad83a52984ee7c53cbed8c867f38e4f866
Reviewed-on: http://gerrit.openafs.org/9155
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2013-02-21 08:50:47 -08:00
Simon Wilkinson
429b9ec350 aklog: Don't reference freed node whilst deleting
Because deletion is implemented using a for loop, the step of the
loop that moves us to the next node references freed memory when
we've deleted an element. Fix this by just shortcircuiting the
return from the function so we immediately exit.

Change-Id: Ia820b20ce5937ac86d849cb746b3bc21f46550fa
Reviewed-on: http://gerrit.openafs.org/9161
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-21 05:16:32 -08:00
Simon Wilkinson
e2e415e984 vos: Remove unused 'done' loop variable
In SendFile we break at the same time as setting the done flag,
so its value is never checked. Just remove it as it is redundant
with the current loop logic.

Caught by clang-analyzer

Change-Id: Ibf8f756b06fd26cb2013ece97eb9196c71ad88bd
Reviewed-on: http://gerrit.openafs.org/9164
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-21 05:15:00 -08:00
Simon Wilkinson
17154a3c0a libadmin: Don't try to release garbage connection
In bos_ServerOpen, initalise the contents of bos_server structure
to 0 using calloc, so that if we jump to the error handling stuff
before they are assigned real values we don't end up trying to
release garbage.

Change-Id: I687d0b637833a08425e75391eb92a2dd4a150301
Reviewed-on: http://gerrit.openafs.org/9163
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-21 04:52:08 -08:00
Simon Wilkinson
a208292dd5 asetkey: Handle unknown key types
If the user tries to create a key which is not rxkad, error out
rather than attempt to add a random blob of memory to the KeyFile.

Caught by clang-analyzer

Change-Id: Id2803fe29153f01ab352747caed31b0d0cb4f573
Reviewed-on: http://gerrit.openafs.org/9160
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-21 04:49:23 -08:00
Simon Wilkinson
5529d5712f Unix CM: Don't check if var is 0, then zero it
There's a couple of places in afs_daemons.c where we do:

    if (code != 0)
        return;
    code = 0;

The final line is obviously redundant, and makes clang sulk at us.
So, remove it.

Caught by clang-analyzer

Change-Id: Ic55edf1b05f3f45eb1f0cecdb3c2318e6f7bd0ec
Reviewed-on: http://gerrit.openafs.org/9154
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-21 04:46:36 -08:00
Simon Wilkinson
1992fbc714 Unix CM: Remove unecessary lastXMinCheck init
Don't init stuff to 0 that's then immediately reinitialised with
a proper value.

Caught by clang-analyzer

Change-Id: Ic0d8b227908fa716167acf64d7653b636e406816
Reviewed-on: http://gerrit.openafs.org/9153
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2013-02-21 04:46:29 -08:00
Simon Wilkinson
d8bee6e470 Unix CM: Remove unused security class initialisation
Caught by clang-analyzer

Change-Id: Iab28a305ae377cabc455132fde3b90146921100b
Reviewed-on: http://gerrit.openafs.org/9152
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-20 12:37:17 -08:00
Simon Wilkinson
ea24520b31 usd: Can't call usd_FileStandard* with NULL
It doesn't make sense to call usd_FileStandard{Input,Output} with
a NULL usd_handle_t (and doing so would crash later in the
function), so don't check for attempts to do so.

Caught by clang-analyzer

Change-Id: I03c0b627056108fe0d6f78d8028323cc4ed74758
Reviewed-on: http://gerrit.openafs.org/9151
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-20 12:30:52 -08:00
Simon Wilkinson
519d43cafb vlserver: bulkaddrs are unsigned ints
bulkaddrs_val is a pointer to an array of unsigned ints, not to
an array of ints. Fix the sizeof() used in the call to malloc to silence
a clang warning.

Change-Id: If39f34756984200fed1cd3f3de5833012b86af21
Reviewed-on: http://gerrit.openafs.org/9149
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-20 12:30:14 -08:00
Simon Wilkinson
0f46f6b333 ptserver: Simplify malloc assignment to shut up clang
Using a temporary variable of type (char *) to store the results
of malloc and realloc, and then casting the tmp variable to the
real type causes clang-analyzer to complain. Just simplify this
code by always using the real type in order to shut it up.

Change-Id: I607bb36d1899dc617fdbd9e09e18ff10c9fa9ce9
Reviewed-on: http://gerrit.openafs.org/9148
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-20 12:30:08 -08:00